Hi.
Im trying to save an Image using C#, and I've created a code that, as far as I can see, should work.
Yet it keeps throwing a GDI+ generic Exception, without any usable error details. It doesn't matter what format I'm trying to save in, it always throws the exeption.
I'm using C# Express 2005 on Vista, if that matters.
Here is the code
Any help would be great.
Thx.
Im trying to save an Image using C#, and I've created a code that, as far as I can see, should work.
Yet it keeps throwing a GDI+ generic Exception, without any usable error details. It doesn't matter what format I'm trying to save in, it always throws the exeption.
I'm using C# Express 2005 on Vista, if that matters.
Here is the code
Code:
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
...
private void SaveImage(object sender, EventArgs eArgs)
{
Bitmap tmp = new Bitmap(200, 200);
Graphics tmpG = Graphics.FromImage(tmp);
tmpG.FillEllipse(Brushes.Black, new Rectangle(10, 10, 180, 180));
tmpG.Save();
tmp.Save("C:\\myimg.jpg", ImageFormat.Jpeg);
}
Thx.
Comment