You're close. In your form, create a MouseUp Event. Then add some code to the event.
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
label1.Text = (e.X + Location.X) + ", " + (e.Y + Location.Y) + " ClickType:" + e.Button;
}
In the code, MouseEventArgs e is an object with the position of your mouse inside your form.
MouseEventArgs also knows the type of mouse click via the e.Button.
Location or this.Location refers to the Form class that you're in. So Location.X will be the X location of the form relative to the screen you're looking at. Same with Location.Y
So the whole program
using System.Windows.Forms;
namespace MousePosition
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
label1.Text = (e.X + Location.X) + ", " + (e.Y + Location.Y) + " ClickType:" + e.Button;
}
}
}
Have fun coding!
Hogan