I have just bought VB.NET and now I want to draw a line but i can't find the line control in the toolbox can you help me ???
Printable View
I have just bought VB.NET and now I want to draw a line but i can't find the line control in the toolbox can you help me ???
Use the form's Paint event and the graphics object like this:
Private Sub Form2_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint
Dim p As Pen
Dim r As Rectangle
r = New Rectangle(100, 100, 40, 40)
p = New Pen(System.Drawing.Color.Red)
e.Graphics.DrawLine(p, 10, 10, 50, 50)
e.Graphics.DrawEllipse(p, r)
End Sub
or a line on a form is simply a label now with without text and the background colour the colour you want the line
Using a label as a line would work, but it's a bit crude.
If they just bought .Net, it'd be worth the effort to learn how to use the System.Drawing and System.Drawing.Drawing2d library for doing things like that. It might take some extra work and learning time, but it will allow more functionality, like diagonal lines.