Drawlines with a non-solid brush vs. Drawlines with a solid brush.

Drawlines with a non-solid brush vs. Drawlines with a solid brush.

Post by Broc » Wed, 29 Oct 2003 01:20:29


I am seeing inconsistent drawing behavior when calling Graphics.DrawLines()
with a pen created from a non solid brush vs. a Graphics.Drawlines() call
with a pen created from a solid brush. The line between the same points is
drawn differently. To see this, create a windows forms project in VS.NET
2003 and override OnPaint and add the following code:

PointF[] points = new PointF[11];
points[0] = new PointF(28, 12);
points[1] = new PointF(45, 116);
points[2] = new PointF(62, 168);
points[3] = new PointF(79, 169);
points[4] = new PointF(96, 127);
points[5] = new PointF(114, 78);
points[6] = new PointF(130, 164);
points[7] = new PointF(147, 106);
points[8] = new PointF(164, 70);
points[9] = new PointF(181, 36);
points[10] = new PointF(199, 16);

e.Graphics.FillRectangle(Brushes.Black, e.ClipRectangle);
using(LinearGradientBrush brush = new LinearGradientBrush(e.ClipRectangle,
Color.White, Color.White, LinearGradientMode.Horizontal))
using(Pen linearPen = new Pen(brush))
{
e.Graphics.DrawLines(linearPen, points);
e.Graphics.DrawLines(Pens.Yellow, points);
}

Notice that you can see the white line as well as the yellow line. Am I
doing something wrong? I need both to draw the same. Is there some property
on the Graphics object I can set?
 
 
 

Drawlines with a non-solid brush vs. Drawlines with a solid brush.

Post by abhishek g » Thu, 30 Oct 2003 02:16:00

I am seeing the exact same behavior. Sounds like a bug in GDI+ to me. Anyone
from MSFT care to comment on this issue?

- Abhishek



Graphics.DrawLines()
is
property