G
Guest
In VB.NET Windows Form, how do I add a line across the form?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Mike said:In VB.NET Windows Form, how do I add a line across the form?
Mike L said:In VB.NET Windows Form, how do I add a line across the form?
Chris said:I did this inside of the forms paint method. Hope it helps.
Chris
Private Sub Main_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim Pen As New Pen(Color.MediumBlue, 2)
Dim TopLine As Integer = 150
Dim BottomLine As Integer = 388
e.Graphics.DrawLine(Pen, 0, TopLine, 640, TopLine)
Mike L said:In VB.NET Windows Form, how do I add a line across the form?
Herfried said:'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.
Chris said: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?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.