C# WInForm 各种控件的移动

 groupPrint.MouseDown += GroupBox1_MouseDown;

#region 弹出层移动
        [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "ReleaseCapture")]
        public static extern void ReleaseCapture();
        [System.Runtime.InteropServices.DllImport("user32.dll", EntryPoint = "SendMessage")]
        public static extern void SendMessage(int hwnd, int wMsg, int wParam, int lParam);
        private void GroupBox1_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                ReleaseCapture();
                SendMessage((int)groupPrint.Handle, 0xA1, 2, 0);

            }
        }

posted @ 2019-10-23 11:41  LuoCore  阅读(374)  评论(0编辑  收藏  举报