G
Guest
Hello,
I am drawing a control with GDI+. It contains an image which turns around a
center.
After turning for a while I get and "Out of Memory" Exception. I am
disposing all the created objects(the ones which are used/created during
turning).
The image is included in the solution as an embedded resource, loaded into a
stream and than created with new Bitmap. But it is always the same image and
I am laoding it only once.
When the Exception occurs the Control is just lost on the screen and instead
i see red framed square with is crossed out.
The Code where the Exception is thrown:
private void OnPaint(Graphics graphics)
{
Matrix matrix = new Matrix();
matrix.RotateAt(Angle, m_center, MatrixOrder.Append);
graphics.Transform = matrix;
graphics.DrawImage(m_image, m_rect);
matrix.RotateAt(-Angle, m_center, MatrixOrder.Append);
graphics.Transform = matrix;
matrix.Dispose();
}
Thanks for any help
Alex
I am drawing a control with GDI+. It contains an image which turns around a
center.
After turning for a while I get and "Out of Memory" Exception. I am
disposing all the created objects(the ones which are used/created during
turning).
The image is included in the solution as an embedded resource, loaded into a
stream and than created with new Bitmap. But it is always the same image and
I am laoding it only once.
When the Exception occurs the Control is just lost on the screen and instead
i see red framed square with is crossed out.
The Code where the Exception is thrown:
private void OnPaint(Graphics graphics)
{
Matrix matrix = new Matrix();
matrix.RotateAt(Angle, m_center, MatrixOrder.Append);
graphics.Transform = matrix;
graphics.DrawImage(m_image, m_rect);
matrix.RotateAt(-Angle, m_center, MatrixOrder.Append);
graphics.Transform = matrix;
matrix.Dispose();
}
Thanks for any help
Alex