First of all I must say that I'm a complete newbie to VB.NET (but not to old VB6) but I've found that I need to 'update' a VB6 program (a scientific data acquisitions program) in it against the clock.:miserable:
At present I'm trying to draw crosses on a form each time the mouse is clicked. Pretty easy huh? Unfortunately while my code works it only draws crosses on the top left hand corner of the form (about up to e.Location = 300). Can anyone tell me what I am doing wrong?:worked_till_5am:
At present I'm trying to draw crosses on a form each time the mouse is clicked. Pretty easy huh? Unfortunately while my code works it only draws crosses on the top left hand corner of the form (about up to e.Location = 300). Can anyone tell me what I am doing wrong?:worked_till_5am:
VB.NET:
Public Class Form3
Dim Gr As Graphics = Me.CreateGraphics()
Private Sub Form3_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
'Draw a cross
Gr.DrawLine(Pens.Blue, e.Location.X - 5, e.Location.Y, e.Location.X + 5, e.Location.Y)
Gr.DrawLine(Pens.Blue, e.Location.X, e.Location.Y - 5, e.Location.X, e.Location.Y + 5)
End Sub
End Class