获取鼠标在窗体上的位置

实现效果:

  

知识运用:

  MouseEventArgs类的X属性Y属性   //该类用来为MouseUp MouseDown 和 MouseMove事件提供数据

实现代码:

        private void Form1_MouseMove(object sender, MouseEventArgs e)
        {
            textBox1.Text = e.X.ToString();
            textBox2.Text = e.Y.ToString();
        }

猜你喜欢

转载自www.cnblogs.com/feiyucha/p/10281449.html