It is very easy to get the position of cursor out side the form\'s boundary by just dragaging the mouse it sends many values to the form when ever the position changes, form
This might help some one.
Here I am using Windows.Forms.Timer and two text boxes for displaying [X and Y] cursor positions. On timer tick calling the API GetCursorPos and getting the cursor position.
public partial class Form1 : Form
{
[DllImport("user32.dll")]
static extern bool GetCursorPos(ref Point lpPoint);
public Form1()
{
InitializeComponent();
timer1.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
var pt = new Point();
GetCursorPos(ref pt);
textBox1.Text = pt.X.ToString();
textBox2.Text = pt.Y.ToString();
}
}
Regards, Ranjeet.