[DllImport("user32.DLL", EntryPoint = "ReleaseCapture")] private extern static void ReleaseCapture(); [DllImport("user32.DLL", EntryPoint = "SendMessage")] private extern static void SendMessage(System.IntPtr hWnd, int wMsg, int wParam, int lParam); private const int SYSTEMCOMMAND = 0x112; private const int SC_DRAGMOVE = 0xF012; private void panel_MouseMove(object sender, MouseEventArgs e) { ReleaseCapture(); SendMessage(this.Handle, SYSTEMCOMMAND, SC_DRAGMOVE, 0); }
how to easily drag a winform application c#
Simply link mousemove events to the panel you want to move.
이동하려는 패널에 마우스무브 이벤트를 연결하면 간단하게 됩니다.