rene7000
January 21st, 2003, 06:33 AM
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 ???
|
Click to See Complete Forum and Search --> : drawing lines and circles rene7000 January 21st, 2003, 06:33 AM 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 ??? DSJ January 21st, 2003, 11:08 AM 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 Jym January 24th, 2003, 05:53 AM or a line on a form is simply a label now with without text and the background colour the colour you want the line DaddyGweedo January 24th, 2003, 02:38 PM 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. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |