獲取鼠標位置及鼠標單擊了哪一個按鍵。
private void GetMousePoint()
{
Point ms = Control.MousePosition;
this.label2.Text = string.Format("當前鼠標位置:{0}:{1}", ms.X, ms.Y);
MouseButtons mb = Control.MouseButtons;this
// 獲取鼠標動做(按下了 那個按鍵)
if (mb == System.Windows.Forms.MouseButtons.Left) this.label1.Text = "Left";
if (mb == System.Windows.Forms.MouseButtons.Right) this.label1.Text = "Right";
if (mb == System.Windows.Forms.MouseButtons.Middle) this.label1.Text = "Middle";orm
}string
//更新鼠標位置等信息。
private void timer1_Tick(object sender, EventArgs e)
{
GetMousePoint();
}
it