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);
        }

 

posted @ 2014-03-20 09:58  Nemo_Li  阅读(194)  评论(0编辑  收藏  举报