M
Mark
I want to use a button click event to draw a set of lines. I using the
following code:
Public Sub DrawLinesPoint(ByVal e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 1)
' Create array of points that define lines to draw.
Dim points As Point() = {New Point(0, 100), New Point(10, 100), _
New Point(200, 50), New Point(250, 300)}
'Draw lines to screen.
e.Graphics.DrawLines(blackPen, points)
End Sub
Private Sub Form1_Paint(ByVal sender As Object, _
ByVal e As System.Windows.Forms.PaintEventArgs) _
Handles Me.Paint
'Will draw the lines, but not like I want.
Call DrawLinesPoint(e)
End Sub
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles ToolStripButton1.Click
'Does not work
Call DrawLinesPoint(e)
End Sub
Eventually I want to send parameters to the DrawLinesPoint Subroutine to
make this procedure more dynamic.
Can someone show me a simple example on how to do this?
Thanks in advance.
following code:
Public Sub DrawLinesPoint(ByVal e As PaintEventArgs)
' Create pen.
Dim blackPen As New Pen(Color.Black, 1)
' Create array of points that define lines to draw.
Dim points As Point() = {New Point(0, 100), New Point(10, 100), _
New Point(200, 50), New Point(250, 300)}
'Draw lines to screen.
e.Graphics.DrawLines(blackPen, points)
End Sub
Private Sub Form1_Paint(ByVal sender As Object, _
ByVal e As System.Windows.Forms.PaintEventArgs) _
Handles Me.Paint
'Will draw the lines, but not like I want.
Call DrawLinesPoint(e)
End Sub
Private Sub ToolStripButton1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles ToolStripButton1.Click
'Does not work
Call DrawLinesPoint(e)
End Sub
Eventually I want to send parameters to the DrawLinesPoint Subroutine to
make this procedure more dynamic.
Can someone show me a simple example on how to do this?
Thanks in advance.