c# - A generic error occurred in GDI+ again -


Text after "

I understand, this message means (what needs to be thrown for unmanaged resources), but in reality I do not understand why this happens in my case:

  System.Drawing.Image imgAnimaha, imgNoanimaha; (Using System.Drawing.Image img = Image.FromStream (file)) (using System.IO.Stream file = thisExe.GetManifestResourceStream ("WindowsApplication1.img.noanimaha135.gif")) {{imgNoanimaha = (System .Drawing.Image) img.Clone (); }} (Using System.Drawing.Image img = Image.FromStream (file)) using {.image = {} (System.Drawing .image) img.Clone (); }} PbDiscovery.Image = imgAnimaha;   

In this case I got "a general error in GDI" + Why solve and how to solve? PS If I will write the following:

  pbDiscovery.Image = imgNoanimaha;   

This works correctly I really do not understand where and which unmanaged resource is not resolved ...

< Div class = "text" itemprop = "text">

The problem is that of Image.Clone (), as:

  (System.Drawing. Image img = Image.FromStream (file)) {imgAnimaha = (System.Drawing.Image) img.Clone (); }   

... does not make a deep copy of the image, it creates a copy of all the header information, but not the actual pixel data (this only shows the original pixel data). Original (and only) pixel data is dealt with the original image object when the scope of the experiment is over.

Then the question goes, what does it mean to use here? I suggest that there is no one to remove the image in a system. Drawing Keep the image object as long as you need pixel data and keep it alive (like the image will need to be recreated) and it does not need to be displayed again after it has been disconnected < / Div>

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -