winform技巧—没有边框移动窗体的方法
2012-06-21 18:46
232 查看
#region 可移动
[DllImport("user32.dll")]
public static extern bool ReleaseCapture();
[DllImport("user32.dll")]
public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_MOVE = 0xF010;
public const int HTCAPTION = 0x0002;
//在窗体的MouseDown事件里加上代码
private void FrmCheer_MouseDown(object sender, MouseEventArgs e)
{
ReleaseCapture();
SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
}
#endregion
[DllImport("user32.dll")]
public static extern bool ReleaseCapture();
[DllImport("user32.dll")]
public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
public const int WM_SYSCOMMAND = 0x0112;
public const int SC_MOVE = 0xF010;
public const int HTCAPTION = 0x0002;
//在窗体的MouseDown事件里加上代码
private void FrmCheer_MouseDown(object sender, MouseEventArgs e)
{
ReleaseCapture();
SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
}
#endregion
相关文章推荐
- WinForm窗体没有系统边框的时候移动窗体
- C#WinForm无边框窗体移动方法、模仿鼠标单击标题栏移动窗体位置
- C# WinForm开发系列之自定义无边框窗体(最大化,最小化,关闭,拉伸和移动的相关知识)
- winform 中用IrisSkin2 皮肤后,鼠标在窗体移动会有闪烁,GroupBox不停的闪烁 解决方法
- C#无边框窗体移动的三种方法
- C#-WinForm-无边框窗体的移动和阴影-API
- C# winform中无边框窗体的移动
- winform无系统边框时移动窗体
- WinForm之无边框窗体的移动
- [转]C#无边框窗体移动的三种方法
- 无边框Winform窗体移动的几种方式
- WinForm无边框窗体和窗体移动 - 调用API
- [转]C#无边框窗体移动的三种方法
- C#移动无边框窗体的简单方法
- WinForm拖动没有标题栏窗体的方法
- C# winform 无边框窗体鼠标点击移动事件
- WinForm 无边框窗体 拖动工作区移动窗体
- VB.NET移动无边框窗体 两种方法
- 无边框窗体的移动方法
- [转]C#无边框窗体移动的三种方法