Example #1
0
 protected override void OnMouseDown(MouseEventArgs e)
 {
     base.OnMouseDown(e);
     if (!base.DesignMode)
     {
         if (canMoveParent || canMoveSelf)
         {
             IntPtr handle = canMoveParent ? Tools.GetParent(this).Handle : (canMoveSelf ? this.Handle : IntPtr.Zero);
             //释放鼠标焦点捕获
             NativeMethods.ReleaseCapture();
             //向当前窗体发送拖动消息
             NativeMethods.SendMessage(handle, 0x0112, 0xF011, 0);
         }
     }
 }