Beispiel #1
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (!LayoutSetting.IsEditMode)
            {
                return;
            }

            _startLoc = e.Location;
            if (MoveRec.Contains(e.X, e.Y))
            {
                MoveResizeAction = MoveResizeAction.Move;
            }
            else if (ResizeRec.Contains(e.X, e.Y))
            {
                var rec   = ResizeRec;
                int diffX = (rec.X + rec.Width) - _startLoc.X;
                int diffY = (rec.Y + rec.Height) - _startLoc.Y;
                _resizeDiffLoc   = new Point(diffX, diffY);
                MoveResizeAction = MoveResizeAction.ResizeBottomRight;
            }
            else
            {
                MoveResizeAction = MoveResizeAction.None;
            }
            OnMouseDownEventForEdit?.Invoke(this, e);
        }
Beispiel #2
0
 private void ChangeCursor(int x, int y)
 {
     if (MoveRec.Contains(x, y))
     {
         Cursor = Cursors.SizeAll;
     }
     else if (ResizeRec.Contains(x, y))
     {
         Cursor = Cursors.SizeNWSE;
     }
     else
     {
         Cursor = Cursors.Default;
     }
 }