Hello eaceful:
I want to draw a line within a Timer_Tick, this is, a Sub within another Sub:
and as you can imagine this does not work.
I don't know much about vb.net - that's for sure - but I'm thinking about using the following code:
that gives me the error message:
You cannnot convert an object of the kind 'System.EventArgs' to the kind 'System.Windows.Forms.PaintEventArgs'
I suppose there has to be a simpler way to draw a line within a Timer_Tick event.
Thank you for your help
I want to draw a line within a Timer_Tick, this is, a Sub within another Sub:
VB.NET:
Private Sub Timer1_Tick(ByVal Sender As Object, ByVal e As EventArgs) Handles Timer1.Tick
Dim blackPen As New Pen(Color.Black, 3)
e.Graphics.DrawLine(blackPen, x1, y1, x2, y2)
End Sub
End Sub
I don't know much about vb.net - that's for sure - but I'm thinking about using the following code:
VB.NET:
Dline.dlinexy(e,x1, y1, x2, y2)
Public Class Dline
Public Shared Function dlinexy(ByVal e As PaintEventArgs, ByVal x1 As Single, ByVal y1 As Single, ByVal x2 As Single, ByVal y2 As Single) As Single
Dim blackPen As New Pen(Color.Black, 3)
e.Graphics.DrawLine(blackPen, x1, y1, x2, y2)
Return (x1) 'useless
End Function
End Class
You cannnot convert an object of the kind 'System.EventArgs' to the kind 'System.Windows.Forms.PaintEventArgs'
I suppose there has to be a simpler way to draw a line within a Timer_Tick event.
Thank you for your help
Last edited: