I\'m creating an application (Windows Form) that allows the user to take a screenshot based on the locations they choose (drag to select area). I wanted to add a little \"pr
MSDN explains that an OutOfMemoryException
means
rect
is outside of the source bitmap bounds
where rect
is the first parameter to the Bitmap.Clone
method.
So check that the cropArea
parameter is not larger than your image.
In GDI+ an OutOfMemoryException
does not really mean "out of memory"; the GDI+ error code OufOfMemory
has been overloaded to mean different things. The reasons for this are historic and a well described by Hans Passant in another answer.