public Point GetHandle(int handleNumber, Draw shape) { Point point = new Point(); switch (handleNumber) { case 1: point = new Point(shape.GetNormalizedRectangle().Left, shape.GetNormalizedRectangle().Top); break; case 2: point = new Point(shape.GetNormalizedRectangle().Right, shape.GetNormalizedRectangle().Top); break; case 3: point = new Point(shape.GetNormalizedRectangle().Left, shape.GetNormalizedRectangle().Bottom); break; case 4: point = new Point(shape.GetNormalizedRectangle().Right, shape.GetNormalizedRectangle().Bottom); break; } return(point); }
private void SetCursor(Point point) { if (_selected != null) { if (_selected.GetNormalizedRectangle().Contains(point)) { Cursor = Cursors.SizeAll; } else { Cursor = Cursors.Default; } } }
public Point GetHandle(int handleNumber, Draw shape) { Point point = new Point(); switch (handleNumber) { case 1: point = new Point(shape.GetNormalizedRectangle().Left, shape.GetNormalizedRectangle().Top); break; case 2: point = new Point(shape.GetNormalizedRectangle().Right, shape.GetNormalizedRectangle().Top); break; case 3: point = new Point(shape.GetNormalizedRectangle().Left, shape.GetNormalizedRectangle().Bottom); break; case 4: point = new Point(shape.GetNormalizedRectangle().Right, shape.GetNormalizedRectangle().Bottom); break; } return point; }
private void drawResizeHandles(Draw shape, Graphics e) { Point topLeft = new Point(shape.GetNormalizedRectangle().Left, shape.GetNormalizedRectangle().Top); Point topRight = new Point(shape.GetNormalizedRectangle().Right, shape.GetNormalizedRectangle().Top); Point bottomLeft = new Point(shape.GetNormalizedRectangle().Left, shape.GetNormalizedRectangle().Bottom); Point bottomRight = new Point(shape.GetNormalizedRectangle().Right, shape.GetNormalizedRectangle().Bottom); Rectangle topLeftRectangle = new Rectangle(topLeft.X - 4, topLeft.Y - 4, 8, 8); e.DrawRectangle(new Pen(Color.Red, 1), topLeftRectangle); Rectangle topRightRectangle = new Rectangle(topRight.X - 4, topLeft.Y - 4, 8, 8); e.DrawRectangle(new Pen(Color.Red, 1), topRightRectangle); Rectangle bottomLeftRectangle = new Rectangle(bottomLeft.X - 4, bottomLeft.Y - 4, 8, 8); e.DrawRectangle(new Pen(Color.Red, 1), bottomLeftRectangle); Rectangle bottomRightRectangle = new Rectangle(bottomRight.X - 4, bottomRight.Y - 4, 8, 8); e.DrawRectangle(new Pen(Color.Red, 1), bottomRightRectangle); }