simone.rosina
New member
- Joined
- Sep 10, 2010
- Messages
- 2
- Programming Experience
- 5-10
Dear all, I'm new in the forum. I have a simple but annoying problem: in a ordinary form I added a label (Label1) and a button (Button1) with the followiing handler.
Well if I press Button1 my dot dashed line is correctly drawn over Label1, but what I need is that program automatically does it on form load.
Please help me, thanks in advance.
Simone
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Graphic As System.Drawing.Graphics
Dim Pen As System.Drawing.Pen
Pen = New System.Drawing.Pen(System.Drawing.Color.Cyan, 2)
Pen.DashStyle = Drawing2D.DashStyle.DashDot
Graphic = Label1.CreateGraphics
Graphic.DrawLine(Pen, 0, CInt(Label1.Height / 2) - 2, CInt(Label1.Width), CInt(Label1.Height / 2) - 2)
Graphic.Dispose()
Pen.Dispose()
End Sub
Well if I press Button1 my dot dashed line is correctly drawn over Label1, but what I need is that program automatically does it on form load.
Please help me, thanks in advance.
Simone
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Graphic As System.Drawing.Graphics
Dim Pen As System.Drawing.Pen
Pen = New System.Drawing.Pen(System.Drawing.Color.Cyan, 2)
Pen.DashStyle = Drawing2D.DashStyle.DashDot
Graphic = Label1.CreateGraphics
Graphic.DrawLine(Pen, 0, CInt(Label1.Height / 2) - 2, CInt(Label1.Width), CInt(Label1.Height / 2) - 2)
Graphic.Dispose()
Pen.Dispose()
End Sub