Hi.
I have a problem. When drawing into a graphics context I sometimes get
access violation exceptions and I can't figure out why. It seems to
have to do with the use of custom dashes. If I change the dash I get
the exception. Following is a code example:
Pen pLine = new Pen(colBkg); // colBkg is a valid color
// fill area with background color. g is a valid graphics context
g.FillRectangle(pLine.Brush, rectArea);
// draw line
pLine.DashStyle = System.Drawing.Drawing2D.DashStyle.Custom;
pLine.DashPattern = new float[] { 1.0f, 30.0f};
pLine.Width = 5.0f;
g.FillPolygon(pLine.Brush, points); // points is a Point Array with
valid points
This works as it's supposed to. But if I change the line where I
define the dash, it throws the exception:
pLine.DashPattern = new float[] { 1.0f, 30.0f, 1.0f}; // -Exception
I know, it's hard to see an error here with so little code.. But it's
only the pattern that causes the Exception. And it only happens with
certain values.. I thought maybe somebody already encountered similar
problems and can give me a hint. Thank you in advance.
Sebastian M. Rouaiha