Пример #1
0
        private void CaptureBorderForm_MouseDown(object sender, MouseEventArgs e)
        {
            if (IsStartedRecord)
            {
                Cursor = Cursors.Default;
                return;
            }

            _startLoc = e.Location;

            if (CenterRec.Contains(e.X, e.Y))
            {
                FormActionType = MoveResizeAction.Move;
            }
            else if (TopLeftRec.Contains(e.X, e.Y))
            {
                FormActionType = MoveResizeAction.ResizeTopLeft;
            }
            else if (TopRightRec.Contains(e.X, e.Y))
            {
                FormActionType = MoveResizeAction.ResizeTopRight;
            }
            else if (BottomRightRec.Contains(e.X, e.Y))
            {
                FormActionType = MoveResizeAction.ResizeBottomRight;
            }
            else if (BottomLeftRec.Contains(e.X, e.Y))
            {
                FormActionType = MoveResizeAction.ResizeBottomLeft;
            }
            else if (LeftRec.Contains(e.X, e.Y))
            {
                FormActionType = MoveResizeAction.ResizeLeft;
            }
            else if (TopRec.Contains(e.X, e.Y))
            {
                FormActionType = MoveResizeAction.ResizeTop;
            }
            else if (RightRec.Contains(e.X, e.Y))
            {
                FormActionType = MoveResizeAction.ResizeRight;
            }
            else if (BottomRec.Contains(e.X, e.Y))
            {
                FormActionType = MoveResizeAction.ResizeBottom;
            }
            else
            {
                FormActionType = MoveResizeAction.None;
            }
        }
Пример #2
0
 private void ChangeCursor(int x, int y)
 {
     if (TopLeftRec.Contains(x, y))
     {
         Cursor = Cursors.SizeNWSE;
     }
     else if (TopRightRec.Contains(x, y))
     {
         Cursor = Cursors.SizeNESW;
     }
     else if (BottomRightRec.Contains(x, y))
     {
         Cursor = Cursors.SizeNWSE;
     }
     else if (BottomLeftRec.Contains(x, y))
     {
         Cursor = Cursors.SizeNESW;
     }
     else if (CenterRec.Contains(x, y))
     {
         Cursor = Cursors.SizeAll;
     }
     else if (LeftRec.Contains(x, y))
     {
         Cursor = Cursors.SizeWE;
     }
     else if (TopRec.Contains(x, y))
     {
         Cursor = Cursors.SizeNS;
     }
     else if (RightRec.Contains(x, y))
     {
         Cursor = Cursors.SizeWE;
     }
     else if (BottomRec.Contains(x, y))
     {
         Cursor = Cursors.SizeNS;
     }
     else
     {
         Cursor = Cursors.Default;
     }
 }