给自己留个笔记, 在用wke做界面的时候. 往往需要把winform窗口设置成无边框
但是WebUI也需要移动窗口, 所以才把以前在易语言中用的方法翻译过来使用
设置无边框窗口
1
| form属性设置 FormBorderStyle = None
|
引用
1
| using System.Runtime.InteropServices;
|
声明DLL调用方法
1 2 3 4 5 6 7 8 9
| [DllImport("user32.dll")] public static extern bool IsZoomed(IntPtr hwnd);
[DllImport("user32.dll")] public static extern bool ReleaseCapture();
[DllImport("user32.dll")] public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
|
为”鼠标按下(MouseDown)”事件添加功能代码
1 2 3 4 5 6 7 8 9 10 11 12
| private void Login_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (IsZoomed(this.Handle) == false) { ReleaseCapture(); SendMessage(this.Handle, 161, 2, 0); } } }
|

这样功能就实现辣