开发者论坛

 找回密码
 注册 (请使用非IE浏览器)
查看: 3382|回复: 1

[求助] FormBorderStyle为None的时候如何拖动窗体

[复制链接]

0

精华

-14

贡献

0

赞扬

帖子
51
软币
244
在线时间
22 小时
注册时间
2014-3-18
发表于 2014-4-2 15:10:40 | 显示全部楼层 |阅读模式
FormBorderStyle为None的时候如何拖动窗体
回复

使用道具 举报

0

精华

8

贡献

134

赞扬

帖子
76
软币
640
在线时间
57 小时
注册时间
2014-1-13
发表于 2014-4-26 17:47:42 | 显示全部楼层
[C#] 纯文本查看 复制代码
[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;

private void Form2_MouseDown(object sender, MouseEventArgs e)
        {
            ReleaseCapture();
            SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
        }
回复

使用道具 举报

Archiver|手机版|小黑屋|开发者网 ( 苏ICP备08004430号-2 )
版权所有:南京韵文教育信息咨询有限公司

GMT+8, 2024-5-3 21:17

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表