C#中无边框窗体移动的简单实例
2013-08-22 16:10
701 查看
Point mouseOff;//鼠标移动位置变量 bool leftFlag;//标记是否为左键 private void Form1_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { mouseOff = new Point(-e.X, -e.Y); //得到变量的值 leftFlag = true; //点击左键按下时标注为true; } }
private void Form1_MouseMove(object sender, MouseEventArgs e) { if (leftFlag) { Point mouseSet = Control.MousePosition; mouseSet.Offset(mouseOff.X, mouseOff.Y); //设置移动后的位置 Location = mouseSet; } }
private void Form1_MouseUp(object sender, MouseEventArgs e) { if (leftFlag) { leftFlag = false;//释放鼠标后标注为false; } }
相关文章推荐
- C#移动无边框窗体的简单方法
- C#无边框窗体移动的三种方法
- c#窗体移动(无边框移动/用户区移动)
- C#中无边框窗体移动
- c# 无边框窗体鼠标点击移动方法
- 使用C#实现移动无边框窗体
- [转]C#无边框窗体移动的三种方法
- c# 移动拖动无边框窗体
- 使用C#实现移动无边框窗体
- C# 无边框窗体移动 点击任务栏实现最小化与还原
- C#实现无边框窗体移动方法
- C# 移动无边框的窗体
- C#处理猜拳问题的简单实例(非窗体)
- [转]C#无边框窗体移动的三种方法
- C#无边框窗体的移动
- C# 无边框窗体的移动,任务栏右键菜单,调整大小
- C# 无边框窗体 移动 两种方法
- c#禁止双击最大化,无边框窗体移动
- C#中无边框窗体移动
- C# 无边框窗体的移动