예제 #1
0
 private void MarkedPicture_MouseDown(object sender, MouseEventArgs e)
 {
     ChangeFocus.CreateInstance()?.Hide();
     SetDownDelt(e.Location);
     if (e.Button == MouseButtons.Left)
     {
         mouseDownPosition = e.Location;  //记录每次点击时鼠标按下的位置
         MouseLeftDown     = true;
     }
     else if (e.Button == MouseButtons.Right)
     {
         if (CurFocus != null && CurFocus != TheBoard)
         {
             Point     de  = ShowToPos(e.Location);
             Direction dir = CurFocus.MouseOverWhere(de);
             if (dir > Direction.outside)
             {
                 Point       p  = e.Location;
                 ChangeFocus cf = ChangeFocus.CreateInstance();
                 p.Offset(getRealLocation(this, theMainForm));
                 cf.Location = p;
                 if (cf.Bottom > Screen.PrimaryScreen.Bounds.Height)
                 {
                     p.Offset(0, -cf.Height);
                     cf.Location = p;
                 }
                 cf.Show();
             }
         }
     }
     TheBoard?.OnMouseDown(sender, e);//ShowToPos(e.Location));
 }
예제 #2
0
 public static ChangeFocus CreateInstance()
 {
     if (singletonForm == null || singletonForm.IsDisposed)
     {
         singletonForm = new ChangeFocus();
     }
     return(singletonForm);
 }