Exemple #1
0
 /// <summary>
 /// 执行拖拽
 /// </summary>
 /// <returns>指示是否拦截消息</returns>
 private static bool DoDrag(Control c, Point point, bool isClientArea)
 {
     try
     {
         Form form;
         if (c == null || (form = c.FindForm()) == null)
         {
             return(false);
         }
         var e = new FormDraggingCancelEventArgs(c, point, isClientArea);
         OnDragging(e);
         if (e.Cancel)
         {
             return(false);
         }
         //当作为MDI子窗体且最大化时,拖MDI主窗体
         if (form.WindowState == FormWindowState.Maximized)
         {
             form = form.MdiParent ?? form;
         }
         SendMessage(form.Handle, 0xA1, (IntPtr)2, IntPtr.Zero);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Exemple #2
0
        private static void OnDragging(FormDraggingCancelEventArgs e)
        {
            var handler = Dragging;

            if (handler != null)
            {
                handler(null, e);
            }
        }
Exemple #3
0
 private static void OnDragging(FormDraggingCancelEventArgs e) => Dragging?.Invoke(null, e);