Point _downPoint;
private void button1_MouseDown(object sender, MouseEventArgs e)
{
_downPoint = new Point(e.X, e.Y);
}
private void button1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
Control ctr = sender as Control;
ctr.Location = new Point(ctr.Location.X + e.X - _downPoint.X, ctr.Location.Y + e.Y - _downPoint.Y);
}
}
C# winform在运行过程中鼠标左键移动控件位置
猜你喜欢
转载自blog.csdn.net/breakbridge/article/details/87085918
今日推荐
周排行