1. 程式人生 > >C#winform實現滑鼠響應左鍵按下,並記下其座標

C#winform實現滑鼠響應左鍵按下,並記下其座標

  private void Form1_MouseClick(object sender, MouseEventArgs e)
        {
            this.label1.Text = "相對座標:" +this.PointToClient(MousePosition).ToString();
            this.label2.Text = "絕對座標:" + this.PointToScreen(MousePosition).ToString();
            this.label3.Text = "e.location=" + e.Location.ToString();//相對座標,效率更高
        }