By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,140 Members | 1,706 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,140 IT Pros & Developers. It's quick & easy.

Draw a line on a form

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
"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

P: n/a
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

P: n/a
"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.