0

I was working on a simple program that reads the location of your mouse coordinates and displaying them inside a label. Now my question is:

Can I set location coordinates inside textbox1 and textbox2 (one for x and second for y) so that mouse pointer will change its real position as soon as I write the parameters?

For example:

private void Form1_MouseMove(object sender, MouseEventArgs e)
{
    e.location.x = textbox1.text;
    e.location.y = textbox2.text;
}
meJustAndrew
  • 6,011
  • 8
  • 50
  • 76
Adi543
  • 29
  • 1
  • 5

1 Answers1

0

From @Mahdi's comment, adapted to your case:

private void Form1_MouseMove(object sender, MouseEventArgs e)
{
    int x = Int32.Parse(textbox1.text);
    int y = Int32.Parse(textbox2.text);
    this.Cursor = new Cursor(Cursor.Current.Handle);
    Cursor.Position = new Point(Cursor.Position.X - x, Cursor.Position.Y - y);
    Cursor.Clip = new Rectangle(this.Location, this.Size);
}
meJustAndrew
  • 6,011
  • 8
  • 50
  • 76