Hi. I experience a System.OutOfMemoryException when I call DrawPath on a GraphicsPath object (name it OverallPath) which contains another, boundary-case GraphicsPath object (named LinePath), and a Pen object (named BluePen) with width greater than 1.5. LinePath contains a set of lines which my program separates (so that they don't appear to loop back to each other) by calling LinePath.StartFigure (or LinePath.CloseFigure) before the iterative generation of each line. Exception only occurs when LinePath contains more than one line, and when both endpoints of LinePath's last line coincide. I include below a C# code sample which replicates the exceptional case. You can run the code by creating a Windows Form project, and then copying this OnPaint() override into Form1.cs.
I appreciate any help, and any workarounds.
Thank you.
Raj
Pen BluePen = new Pen(Color.Blue, 1.5001F);
protected override void OnPaint( PaintEventArgs e )
{
base.OnPaint(e);
GraphicsPath LinePath = new GraphicsPath();
//Crash also occurs with CloseFigure() call instead.
LinePath.StartFigure();
Point StartPoint = new Point(132, 184);
Point EndPoint = new Point(200, 32);
LinePath.AddLine(StartPoint, EndPoint);
LinePath.StartFigure();
LinePath.AddLine(34, 35, 34, 35);
//Crashing does not occur if single-point line somewhere in the GraphicsPath object's middle.
// LinePath.StartFigure();
// LinePath.AddLine(1, 2, 3, 4);
GraphicsPath OverallPath = new GraphicsPath();
OverallPath.AddPath(LinePath, true);
Graphics dc = e.Graphics;
//Crashes here.
dc.DrawPath(BluePen, OverallPath);
}