Reputation: 2014
Does anybody know how can I make a TextBox follow the mouse cursor on a simple form?
Upvotes: 2
Views: 4238
Reputation:
I've done this code for you, check this answer :
Private Sub Form1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
Label1.Text = e.X.ToString
Label2.Text = e.Y.ToString
Me.TextBox1.Location = New System.Drawing.Point(e.X + 10, e.Y + 10)
End Sub
Upvotes: 0
Reputation: 855
In MouseMove
event handler of your form
textBox.Location = new Point(e.X, e.Y); Invalidate();
e
is MouseEventArgs
Upvotes: 1