您的位置:首页 > 编程语言

winform中主窗体可以实现拖动代码

2015-09-09 13:30 375 查看
[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 Login_MouseDown_1(object sender, MouseEventArgs e) {

if (e.Button == MouseButtons.Left) {

ReleaseCapture();

SendMessage(Handle, 0xA1, 0x02, 0); } }

引入命名空间:using System.Runtime.InteropServices;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: