private void PictureBox1_MouseMove(object sender, MouseEventArgs e)
{
mouseMoveX = e.X; mouseMoveY = e.Y;
ThreadStart updateThread = delegate
{
UpdateLabel(mouseMoveX, mouseMoveY);
};
new Thread(updateThread).Start();
}
//The following will update the text on label1 which outputs the coordinates of your mouse pointer
private void UpdateLblText(string text)
{
label1.Text = text;
}
//This delegate will be invoked to update the UI from the later invoking method which sits on the new thread
public delegate void lblCallback(string text);
private void UpdateLabel(int mX, int mY)
{
Invoke(new lblCallback(UpdateLblText), new object[] { string.Concat(string.Concat(string.Concat("MOUSE COORDINATES :: MouseX.", mouseMoveX, " / MouseY.", mouseMoveY)))});
}