[转]C# WInForm 无框窗体移动
生活随笔
收集整理的這篇文章主要介紹了
[转]C# WInForm 无框窗体移动
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
本文轉自:http://hi.baidu.com/yore2003/blog/item/f385df22377156f5d6cae239.html 調用API
??? using System.Runtime.InteropServices;
??? [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;
??? using System.Runtime.InteropServices;
??? [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 Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
?? {
??? ReleaseCapture();
??? SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
?? }
轉載于:https://www.cnblogs.com/huaiyu2006/archive/2008/11/26/1341480.html
總結
以上是生活随笔為你收集整理的[转]C# WInForm 无框窗体移动的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 梦到抹口红是什么意思
- 下一篇: c# char unsigned_dll