void OnMouseMove(object sender, MouseEventArgs args) { switch (_dragMode) { case DragMode.None: var hit = HitTest(_graph.Window, args.Location); switch (hit) { case HitKind.None: _graph.Control.Cursor = Cursors.Default; _dragMode = DragMode.None; _hypotheticalDragMode = DragMode.None; _dragStart = null; break; case HitKind.LeftEdge: _graph.Control.Cursor = Cursors.SizeWE; _hypotheticalDragMode = DragMode.ResizeLeft; break; case HitKind.RightEdge: _graph.Control.Cursor = Cursors.SizeWE; _hypotheticalDragMode = DragMode.ResizeRight; break; case HitKind.Center: _graph.Control.Cursor = Hand; _hypotheticalDragMode = DragMode.Center; break; } break; case DragMode.ResizeLeft: ResizeLeft(_graph.Window, _dragStart.Value, args.Location); _dragStart = args.Location; _graph.Draw(); break; case DragMode.ResizeRight: ResizeRight(_graph.Window, _dragStart.Value, args.Location); _dragStart = args.Location; _graph.Draw(); break; case DragMode.Center: Drag(_graph.Window, _dragStart.Value, args.Location); _dragStart = args.Location; _graph.Draw(); break; default: throw new ArgumentOutOfRangeException(); } }