can I draw a line on the label at design time?

mech3

Member
Joined
Sep 14, 2005
Messages
12
Programming Experience
Beginner
how can I draw a permanent line on the form that it always stay there.
I want to do this while designing not at the runtime
Because this line must be on the another control(example:eek:n the label)
in vb6, I was doing this by clicking line button on the toolbox then I was drawing anywhere I want.
I couldn't do this at the vb.net. which component do I need to add?
thanks
 
mech3 - you can override the onPaint() method to draw on the form as part of it's refresh. For example, this will add a dotted line to a component:

VB.NET:
Protected Overrides Sub onpaint(ByVal e As PaintEventArgs)[indent]         ' Paints a divider line at the bottom of the component
         MyBase.OnPaint(e)
         Dim g As Graphics = Me.CreateGraphics
         Dim myPen As New Pen(Color.Gray)
         myPen.DashStyle = Drawing2D.DashStyle.Dot
         myPen.Width = 1
         g.DrawLine(myPen, 4, Me.Height - 1, Me.Width - 4, Me.Height - 1)
         g.Dispose()
         myPen.Dispose()
[/indent]End Sub
This is assuming you are just doing form layout and need a line as a simple graphic -- not creating a drawing program :)
 
Back
Top