DrawPath OutOfMemoryException

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

I've got a PictureBox where the end user can draw rectangles, lines,
ellipses and freehand on an image. Everything works fine, except for an
occasional OutOfMemoryException. It only occurs when drawing freehand and
there's already a figure (StartFigure is called again), the first line is
added to the figure and DrawPath is called. The exception occurs (only
occasionally) when the call is made to DrawPath. It only happens when the
pen width >= 2. I can get around the exception by leaving the mouse over
the image with the left button pressed down, and pressing the space bar to
clear the exception.

Dave
 
Solved the problem by writing my own figure and drawpath.

| I've got a PictureBox where the end user can draw rectangles, lines,
| ellipses and freehand on an image. Everything works fine, except for an
| occasional OutOfMemoryException. It only occurs when drawing freehand and
| there's already a figure (StartFigure is called again), the first line is
| added to the figure and DrawPath is called. The exception occurs (only
| occasionally) when the call is made to DrawPath. It only happens when the
| pen width >= 2. I can get around the exception by leaving the mouse over
| the image with the left button pressed down, and pressing the space bar to
| clear the exception.
|
| Dave
|
|
 
Back
Top