469,636 Members | 1,781 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,636 developers. It's quick & easy.

Draw a line on a form

Hi All,

I am sure this is a simple question, but how do I draw a
line onto a windows form in VB.NET, or any shape for that
matter. VB6 had a line and shape control that you could
use.

Thanks,
Steve
Nov 19 '05 #1
3 15722
"Steve" <we*@zuna.co.uk> wrote in message
news:0f****************************@phx.gbl...
Hi All,

I am sure this is a simple question, but how do I draw a
line onto a windows form in VB.NET, or any shape for that
matter. VB6 had a line and shape control that you could
use.


At design time you can use a Label control and set it's height, or width to
1 (I like to use 2px and set the border to 3D - nice chiseled effect). There
are also several home-grown line controls. Or you can draw them manually at
runtime using GDI+ (System.Drawing namespace).

HTH,
Jeremy

Nov 19 '05 #2
Hello,

"Steve" <we*@zuna.co.uk> schrieb:
I am sure this is a simple question, but how do I draw a
line onto a windows form in VB.NET, or any shape for that
matter. VB6 had a line and shape control that you could
use.


Line control "replacement":

http://download.microsoft.com/downlo...3-9194-ab57acd
8ea01/LineControls.msi

Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet
Nov 19 '05 #3
"Steve" <we*@zuna.co.uk> schrieb
I am sure this is a simple question, but how do I draw a
line onto a windows form in VB.NET, or any shape for that
matter. VB6 had a line and shape control that you could
use.

Override the Form's OnPaint method. Use e.graphics to draw graphics.

Outside the OnPaint procedure:
dim g as graphics
g = Me.creategraphics
'draw on g here
'...
g.dispose
--
Armin

Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Dennis | last post: by
18 posts views Thread by Ed Bitzer | last post: by
4 posts views Thread by thomasp | last post: by
2 posts views Thread by dan heskett | last post: by
4 posts views Thread by Jason Huang | last post: by
1 post views Thread by Alejandro | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.