M
mcm
I need to do an animation of several run-time generated drawings.
The drawings are approximately 200x400
I'm trying to do it in this manner, however I keep getting OutOFMemoryException's when I try to create the images with the "new Bitmap" call.
I don't think that these images are all that big - are they? How can I do this without the exceptions in C# compact framework?
Example code
{
Image[] myImages = new Image[36];
for (int i=0; i<36; i++)
{
Rectangle rectDraw ;
rectDraw.X = 0;
rectDraw.Y = 0;
rectDraw.Width = 200;
rectDraw.Height = 400
myImages = DrawTheImage(rectDraw) ;
}
}
public Image DrawTheImage (Rectangle rectDraw)
{
Image thisImage = new Bitmap(rectDraw.Width, rectDraw.Height); // CRASH after about 20 calls
Graphics g = Graphics.FromImage(thisImage);
g.DrawMyStuffHere .............
g.Dispose();
return thisImage;
}
The drawings are approximately 200x400
I'm trying to do it in this manner, however I keep getting OutOFMemoryException's when I try to create the images with the "new Bitmap" call.
I don't think that these images are all that big - are they? How can I do this without the exceptions in C# compact framework?
Example code
{
Image[] myImages = new Image[36];
for (int i=0; i<36; i++)
{
Rectangle rectDraw ;
rectDraw.X = 0;
rectDraw.Y = 0;
rectDraw.Width = 200;
rectDraw.Height = 400
myImages = DrawTheImage(rectDraw) ;
}
}
public Image DrawTheImage (Rectangle rectDraw)
{
Image thisImage = new Bitmap(rectDraw.Width, rectDraw.Height); // CRASH after about 20 calls
Graphics g = Graphics.FromImage(thisImage);
g.DrawMyStuffHere .............
g.Dispose();
return thisImage;
}