refresh

导航

winform无系统边框时移动窗体

 1         [DllImport("user32.dll")]
 2         public static extern bool ReleaseCapture();
 3         [DllImport("user32.dll")]
 4         public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);
 5         public const int WM_SYSCOMMAND = 0x0112;
 6         public const int SC_MOVE = 0xF010;
 7         public const int HTCAPTION = 0x0002;
 8 
 9         private void Form_Login_MouseDown(object sender, MouseEventArgs e)
10         {
11             ReleaseCapture();
12             SendMessage(this.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0);
13         }

posted on 2012-07-24 09:31  refresh  阅读(209)  评论(0)    收藏  举报