從網上看到了一個窗體拖動事件超級簡潔至少現在這個階段我是看起來有困難的有興趣的哥們們可以討論下using Systemusing SystemCollectionsGenericusing SystemComponentModel
using SystemDatausing SystemDrawingusing SystemTextusing SystemWindowsFormsnamespace WindowsApplication{ public partial class Form Form
{ private const int WM_NCHITTEST = x//這幾行真夠暈的貌似調用了基本函數餓
private const int HTCLIENT = x private const int HTCAPTION = x public Form()
{ InitializeComponent() } protected override void WndProc(ref Message m)
{ switch (mMsg)
{ case WM_NCHITTEST baseWndProc(ref m)
if ((int)mResult == HTCLIENT) mResult = (IntPtr)HTCAPTION return break }
baseWndProc(ref m) } }}
我試過了可以運行就是貌似最後那個break有點問題看不懂……嘿嘿 還得繼續努力啊!
From:http://tw.wingwit.com/Article/program/net/201311/13861.html