Does anybody knows why a Pen of 0 point width still draw a line
For example, I expected the following code to draw nothing on the PictureBox :
Private
Sub PictureBox1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Painte.Graphics.DrawLine(New Pen(Color.Brown, 0), 10, 10, 150, 150)
End Sub
But i still get a line of one point width.
Is it normal, or is it a bug of VS 2005 beta
Thanks,
Patrick

[VS2005] 0 width pen still draws a line
Lynn33
That is by design/normal. The Pen.Width property when set to 0 will result in the pen drawing as if it were set to 1 according to the docs I am looking at (up to date VS 2005 Docs). Is there a scenario where being able to set it to 0 would be a benefit
Thanks
Robert
Steve Cook
Robert
JamesHeiser
I am creating a control where some lines have a customizable width. The developer can choose a width of 0 if he does not want to see these lines.
Drawing them, even in this case, give a simplier code because I would not have to include the drawing functions in a "if width <> 0 then..." statement.
I like to write as few lines of code as possible to get a clearer result.
Thanks for the answer.
Patrick