今天在网上查一些资料的时候, 无意中发现另一种办法, 非常方便, 调用系统的 API 来实现的, 效果也很好. 赶紧收藏了~
实现代码如下:

[DllImport("user32.dll")]
public static extern bool ReleaseCapture();

[DllImport("user32.dll")]
public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);

private void frmMain_MouseDown(object sender, MouseEventArgs e)
{
ReleaseCapture();
SendMessage(this.Handle, 0x0112, 0xF012, 0);
}

以上就是【C# Winform 让整个窗口都可以拖动】的全部内容了,欢迎留言评论进行交流!

赞(0) 踩(0)

与本文相关的软件

发表我的评论

最新评论

  1. 暂无评论