Bitmap PixelFormat causing OutOfMemoryException
When I add a size to Bitmap
bmp
setting the label.Image
throws an OutOfMemoryException
, but not when I remove the size to Bitmap bmp
Does anyone know what I have to do to fix this?
3 Replies
BoxSize is nothing crazy, its set to 100
Which line does the exception happen on?
Looking at the source code for Bitmap and Graphics they don't seem to ever throw OutOfMemoryException directory so I guess your system doesn't have enough memory to store the image?
Either that or the runtime is memory limited or something like that
promotionQueen.Image = bmp.Clone(move.PromotedPiece.PieceOfImage, bmp.PixelFormat);
throws the exception, I have accessed the image at other places in my code and everything works fine. Without adding the Size to the decleration of
bmp
this code runs fine too, the image is just too big for the label