C#鼠标按住标题移动时移动窗体
2012-08-25 10:52
330 查看
//鼠标在标题处按下时记录鼠标位置
private void label_caption_MouseDown(object sender, MouseEventArgs e)
{
mousePoint = new Point(e.X, e.Y);
}
//鼠标按住标题移动时移动窗体
private void label_caption_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.SetBounds(this.Location.X + e.X - mousePoint.X, this.Location.Y + e.Y - mousePoint.Y, this.Width, this.Height);
}
}
private void label_caption_MouseDown(object sender, MouseEventArgs e)
{
mousePoint = new Point(e.X, e.Y);
}
//鼠标按住标题移动时移动窗体
private void label_caption_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.SetBounds(this.Location.X + e.X - mousePoint.X, this.Location.Y + e.Y - mousePoint.Y, this.Width, this.Height);
}
}
相关文章推荐
- C#移动无标题栏窗体的四种代码
- C#无标题栏窗体鼠标拖动
- C#无标题栏窗体鼠标拖动
- 按住鼠标左键移动窗体
- C#利用Label标签控件模拟窗体标题的移动及窗体颜色不断变换效果
- c#实现随鼠标移动窗体
- C#无标题栏窗体鼠标拖动
- C# winform无标题窗体随意移动
- C#无标题栏窗体鼠标拖动
- C# winform 无边框窗体鼠标点击移动事件
- [C#]使用Label标签控件模拟窗体标题的移动及窗体颜色不断变换
- C# 系统应用之无标题窗体移动的两种方法
- c#实现随鼠标移动窗体
- C#之移动无标题栏窗体功能的实现!...
- Qt按住鼠标窗体随之移动
- C#WinForm无边框窗体移动方法、模仿鼠标单击标题栏移动窗体位置
- 在C#中 从一个picturebox中 按住鼠标左键不放 画一块区域后,另外一个picturebox(在一个winform 窗体上有两个picturebox )上马上把对应的截取图像显示出来
- c#实现随鼠标移动窗体
- C#之移动无标题栏窗体功能的实现!...
- C# 令某个窗体可跟着鼠标移动