winform无边框拖动

        [DllImport("user32.dll")]

        public static extern bool ReleaseCapture();

        [DllImport("user32.dll")]

        public static extern bool SendMessage(IntPtr hwnd, int wMsg, int wParam, int lParam);

        public const int WmSyscommand = 0x0112;

        public const int ScMove = 0xF010;

        public const int Htcaption = 0x0002; 





        private void FrmMouseDown(object sender, MouseEventArgs e)

        {

            ReleaseCapture();

            SendMessage(Handle, WmSyscommand, ScMove + Htcaption, 0);

        }

 

你可能感兴趣的:(WinForm)