窗體的拖動

直接貼代碼

-----------------------------------

有更好的方法可以討論討論哈

==================================

[DllImport("user32.dll")]
        public static extern bool ReleaseCapture();
        [DllImport("user32.dll")]
        public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wparam, int lparam);
        private void panzHead_MouseDown(object sender, MouseEventArgs e) {
            if (e.Button == MouseButtons.Left) {
                // 釋放鼠標使能夠手動操作
                //ReleaseCapture();
                this.panzHead.Capture = false;
                // 拖動窗體
                //SendMessage(this.Handle, 0x0112, 0xF010 + 0x0002, 0);
                SendMessage(this.Handle, 0x00A1, 2, 0);
            }
        }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章