Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

A generic error occurred in GDI+

$
0
0

I am able to run the code snipped I posted below without any issues on my machine both debug and installed version(running Windows 7, 64 bit, VS 2010).  It however crashes on the test machines (both Vista and Windows 7) and throws an exception A generic error occurred in GDI+.  Any ideas on why this might be happening.  Appreciate the help.

Bitmap bmp = new Bitmap(width, Height);
			using (Graphics graphics = Graphics.FromImage(bmp))
			{
				Font font = new Font(fontname, fontsize);
				graphics.FillRectangle(new SolidBrush(bgcolor), 0, 0, bmp.Width, bmp.Height);
				graphics.DrawString(txt, font, new SolidBrush(fcolor), 0, 0);
				graphics.Flush();
				font.Dispose();
				graphics.Dispose();
				System.Threading.Thread.Sleep(50);
				bmp.Save(_firmInformationFilePath, ImageFormat.Png);
			}
			bmp.Dispose();

However


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>