123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using System.Drawing;
- namespace PaintDotNet
- {
- public sealed class SnapObstacleController
- : SnapObstacle
- {
- /// <summary>
- /// Used for the obstacle to report changes in the obstacles size and/or location.
- /// </summary>
- public void SetBounds(Rectangle bounds)
- {
- if (this.bounds != bounds)
- {
- OnBoundsChanging();
- this.previousBounds = this.bounds;
- this.bounds = bounds;
- OnBoundsChanged();
- }
- }
- /// <summary>
- /// Raised when the SnapManager is requesting that the obstacle move and/or resize itself.
- /// Usually this happens in response to another snap container with "sticky edges" changing
- /// its boundary.
- /// </summary>
- public event HandledEventHandler<Rectangle> BoundsChangeRequested;
- protected override void OnBoundsChangeRequested(Rectangle newBounds, ref bool handled)
- {
- if (BoundsChangeRequested != null)
- {
- HandledEventArgs<Rectangle> e = new HandledEventArgs<Rectangle>(handled, newBounds);
- BoundsChangeRequested(this, e);
- handled = e.Handled;
- }
- base.OnBoundsChangeRequested(newBounds, ref handled);
- }
- public SnapObstacleController(string name, Rectangle bounds, SnapRegion snapRegion, bool stickyEdges)
- : base(name, bounds, snapRegion, stickyEdges)
- {
- }
- public SnapObstacleController(string name, Rectangle bounds, SnapRegion snapRegion, bool stickyEdges, int snapProximity, int snapDistance)
- : base(name, bounds, snapRegion, stickyEdges, snapProximity, snapDistance)
- {
- }
- }
- }
|