How To Get Cursor Position In C#
In This C# Tutorial We Will See How To Get Mouse Coordinates [X ; Y] In CSharp Programming Language.
Project Source Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class FormMouseCR : Form
{
public FormMouseCR()
{
InitializeComponent();
}
private void FormMouseCR_MouseClick(object sender, MouseEventArgs e)
{
label1.Text = "X = " + e.X + " ; Y = " + e.Y;
}
private void FormMouseCR_MouseMove(object sender, MouseEventArgs e)
{
label1.Text = "X = " + e.X + " ; Y = " + e.Y;
}
}
}
// OUTPUT :