"Chris" <no@spam.com> schrieb:
>> In VB.NET Windows Form, how do I add a line across the form?
>
[quoted text clipped - 9 lines]
> Dim BottomLine As Integer = 388
> e.Graphics.DrawLine(Pen, 0, TopLine, 640, TopLine)
'Pen' objects should be disposed if they are not needed any more. It's
better to store the 'Pen' object in a private variable, for example, instead
of creating a new pen every time the form is drawn.

Signature
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Chris - 29 Jun 2005 16:11 GMT
> "Chris" <no@spam.com> schrieb:
>
[quoted text clipped - 15 lines]
> better to store the 'Pen' object in a private variable, for example,
> instead of creating a new pen every time the form is drawn.
Thanks for the info. If I use the same pen for the life of the form
should I still dispose of it when the form is closed, or will the
auto-disposing of the form take care of it for me?
chris
Herfried K. Wagner [MVP] - 29 Jun 2005 16:43 GMT
"Chris" <no@spam.com> schrieb:
>>> Private Sub Main_Paint(ByVal sender As Object, ByVal e As
>>> System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
[quoted text clipped - 11 lines]
> should I still dispose of it when the form is closed, or will the
> auto-disposing of the form take care of it for me?
You may want to call the pen's 'Dispose' method in the form's overridden
'Dispose' method.

Signature
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>