Line on a VB.NET form

B

brian

This is driving my crazy! I can not find the option to
draw a line in VB.NET. In VB6 there was a line control
drag and drop. Can someone help please?

I am assumming it is hidden somewhere!

Thanks
 
E

Elena Arzac [msft]

You can use the Graphics.DrawLine method. For example:
Dim myPen As New System.Drawing.Pen(System.Drawing.Color.Red)
Dim formGraphics as System.Drawing.Graphics
formGraphics = Me.CreateGraphics()
formGraphics.DrawLine(myPen, 0, 0, 200, 200)
myPen.Dispose()
formGraphics.Dispose()

For more you can take a look in help under "graphics, examples [Visual
Basic]" or "graphics, what's changed"

Elena Arzac

--------------------
 
J

Jeremy Cowles

This is driving my crazy! I can not find the option to
draw a line in VB.NET. In VB6 there was a line control
drag and drop. Can someone help please?

This is another question that is asked, over and over and over and over. If
you search http://groups.google.com/ you will find tons of results, or you
can search MSDN, or the .NET Help files. I belive I saw Wagner post a link
to a downloadable line control before, but here is the official MS
statement:

http://msdn.microsoft.com/library/en-us/vbcon/html/vxconchangestolinecontrolinvisualbasicnet.asp

Basically, they say use a label control with no text and no border & set the
bg color to black, and the width or height = 1

HTH

~
Jeremy
 

Ask a Question

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.

Ask a Question

Top