|
-
January 21st, 2003, 07:33 AM
#1
drawing lines and circles
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 ???
-
January 21st, 2003, 12:08 PM
#2
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
-
January 24th, 2003, 06:53 AM
#3
or a line on a form is simply a label now with without text and the background colour the colour you want the line
-
January 24th, 2003, 03:38 PM
#4
That works...
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|