I am just learning GDI. I am just trying to draw some lines etc. All the examples on the web occur from screen load. I want to draw when i hit a button. What do I need to change.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Protected Overrides Sub OnPaint(ByVal pe As PaintEventArgs)
Dim g As Graphics = pe.Graphics
Dim pn As New Pen(Color.Blue)
' Rectangle rect = new Rectangle(50, 50, 200, 100);
Dim pt1 As New Point(30, 30)
Dim pt2 As New Point(110, 100)
g.DrawLine(pn, pt1, pt2)
Dim fnt As New Font("Verdana", 16)
g.DrawString("GDI+ World", fnt, New SolidBrush(Color.Red), 60, 60)
End Sub
I think there is a problem with the sub parameters. But I am not sure how to fix it.
Thanks
Simi
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Protected Overrides Sub OnPaint(ByVal pe As PaintEventArgs)
Dim g As Graphics = pe.Graphics
Dim pn As New Pen(Color.Blue)
' Rectangle rect = new Rectangle(50, 50, 200, 100);
Dim pt1 As New Point(30, 30)
Dim pt2 As New Point(110, 100)
g.DrawLine(pn, pt1, pt2)
Dim fnt As New Font("Verdana", 16)
g.DrawString("GDI+ World", fnt, New SolidBrush(Color.Red), 60, 60)
End Sub
I think there is a problem with the sub parameters. But I am not sure how to fix it.
Thanks
Simi