Take a look at the MouseEventArgs class . In particular, the GetPosition method . The MSDN example uses onMouseMove, but you should also do the same with onMouseClick. Or just use the MouseClick event of the form.
eg. using the MouseClick event:
In your form:
this.MouseClick += new MouseEventHandler(myForm_MouseClick);
void myForm_MouseClick(object sender, MouseEventArgs e)
{
int myX = e.X;
int myY = e.Y;
}
source
share