c#实现无标题栏窗口的拖动

[DllImport("user32.dll")]
        public static extern IntPtr SendMessage(IntPtr hWnd,int msg,int wparam,int lparam);
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            if (e.Button == MouseButtons.Left)//按下的是鼠标左键            
             {
              Capture = false;//释放鼠标使能够手动操作                
                SendMessage(Handle, 0x00A1, 2, 0);//拖动窗体            
             }
        }

posted @ 2014-02-11 09:35  qanholas  阅读(696)  评论(0编辑  收藏  举报