public void RegisterDragActive(DragItem d, DragHandleAnchor excludePositionAnchor) { if (excludePositionAnchor != this.PositionAnchor) { this.UpdateBoxLocation(d); } }
protected override DragHandleAnchor SetCursor(Point point, ImageBox box) { Cursor cursor = Cursors.Default; DragHandleAnchor handleAnchor = DragHandleAnchor.None; if (Selected) { var handle = HitTest(point); if (handle != null) { handleAnchor = handle.Anchor; if (handleAnchor != DragHandleAnchor.None && handle.Enabled) { _selectHandle = handle; switch (handleAnchor) { case DragHandleAnchor.TopLeft: cursor = Cursors.SizeAll; break; case DragHandleAnchor.MiddleCenter: cursor = Cursors.SizeAll; break; default: throw new ArgumentOutOfRangeException(); } } } } box.Cursor = cursor; return(handleAnchor); }
public ResizeBox(DragHandleAnchor positionAnchor, System.Windows.Forms.Control parent) { this.Name = string.Format("{0}_resize_{1}", parent.Name, positionAnchor.ToString()); this.Width = CustomControl.ResizeBox; this.Height = CustomControl.ResizeBox; this.Location = new System.Drawing.Point(0, 0); this.BackColor = SystemColors.MenuHighlight; this.PositionAnchor = positionAnchor; }
public void UpdateLocationBoxResize(DragItem dragItem, DragHandleAnchor excludePositionAnchor) { rTopLeft.RegisterDragActive(dragItem, excludePositionAnchor); rTopCenter.RegisterDragActive(dragItem, excludePositionAnchor); rTopRight.RegisterDragActive(dragItem, excludePositionAnchor); rMiddleLeft.RegisterDragActive(dragItem, excludePositionAnchor); rMiddleRight.RegisterDragActive(dragItem, excludePositionAnchor); rBottomLeft.RegisterDragActive(dragItem, excludePositionAnchor); rBottomRight.RegisterDragActive(dragItem, excludePositionAnchor); rBottomCenter.RegisterDragActive(dragItem, excludePositionAnchor); }
internal override void MouseDown(MouseEventArgs e, ImageBox box) { if (e.Button == MouseButtons.Left) { _isLeftMouseDown = true; _leftMouseDownAnchor = SetCursor(e.Location, box); _lastRoiRegion = Rect; _lastMousePoint = e.Location; _lastImagePoint = Rect.Location; box.Invalidate(); } }
private void StartResize(DragHandleAnchor anchor) { if (this.IsMovingSelection || this.IsResizingSelection) { throw new InvalidOperationException("A move or resize action is currently being performed."); } var e = new CancelEventArgs(); this.OnSelectionResizing(e); if (!e.Cancel) { this.ResizeAnchor = anchor; this.PreviousSelectionRegion = this.SelectionRegion; this.IsResizingSelection = true; } }
internal override void MouseDown(MouseEventArgs e, ImageBox box) { if (e.Button == MouseButtons.Left) { _isLeftMouseDown = true; _leftMouseDownAnchor = SetCursor(e.Location, box); _lastMousePoint = e.Location; if (_leftMouseDownAnchor == DragHandleAnchor.TopLeft) { _lastImagePoint = GetPt(_selectHandle.Uid); } else if (_leftMouseDownAnchor == DragHandleAnchor.MiddleCenter) { _lastPolygonPts.Clear(); foreach (var keyVal in _polygonPts) { _lastPolygonPts.Add(keyVal.Key, keyVal.Value); } } box.Invalidate(); } }
public DragHandle(DragHandleAnchor anchor) : this() { this.Anchor = anchor; }
private void StartResize(DragHandleAnchor anchor) { CancelEventArgs e; if (this.IsMoving || this.IsResizing) { throw new InvalidOperationException("A move or resize action is currently being performed."); } e = new CancelEventArgs(); this.OnSelectionResizing(e); if (!e.Cancel) { this.ResizeAnchor = anchor; this.PreviousSelectionRegion = this.SelectionRegion; this.IsResizing = true; } }
public DragHandle this[DragHandleAnchor index] { get { return(_items[index]); } }
public DragHandle(DragHandleAnchor anchor) { Anchor = anchor; }
public void RegisterDragActive(DragItem d, DragHandleAnchor excludePositionAnchor) { if (excludePositionAnchor != this.PositionAnchor) this.UpdateBoxLocation(d); }
public void AddCustomDragHandle(DragHandleAnchor anchor) { _items.Add(anchor, new DragHandle(anchor)); }