ResizingTool

StockSharp.Xaml.Diagram.GXDiagram.Tool

The ResizingTool is used to interactively change the size of an element.

Inherits: DiagramTool

Properties

AdornedElement
protected FrameworkElement AdornedElement { get; set; }
value = resizingTool.AdornedElement
resizingTool.AdornedElement = value

Gets or sets the current FrameworkElement that is being resized.

AdornedNode
protected Node AdornedNode { get; }
value = resizingTool.AdornedNode

Gets the current Node that the AdornedElement is in.

CellSize
public Size CellSize { get; set; }
value = resizingTool.CellSize
resizingTool.CellSize = value

Gets or sets the cell size of the selected element, so that resizing is limited to multiples of the cell size.

Handle
protected FrameworkElement Handle { get; set; }
value = resizingTool.Handle
resizingTool.Handle = value

Gets or sets the current resize handle that is being dragged.

MaxSize
public Size MaxSize { get; set; }
value = resizingTool.MaxSize
resizingTool.MaxSize = value

Gets or sets the maximum size of the selected element.

MinSize
public Size MinSize { get; set; }
value = resizingTool.MinSize
resizingTool.MinSize = value

Gets or sets the minimum size of the selected element.

OriginalBounds
protected Rect OriginalBounds { get; set; }
value = resizingTool.OriginalBounds
resizingTool.OriginalBounds = value

Gets or sets the bounds, in model coordinates, of the AdornedElement when the user started resizing.

OriginalLocation
protected Point OriginalLocation { get; set; }
value = resizingTool.OriginalLocation
resizingTool.OriginalLocation = value

Gets or sets the location, in model coordinates, of the AdornedNode when the user started resizing.

Methods

CanStart
public override bool CanStart()
result = resizingTool.CanStart()

The ResizingTool may run when there is a mouse-down event on a resize handle.

ComputeCellSize
protected virtual Size ComputeCellSize()
result = resizingTool.ComputeCellSize()

The size should be a multiple of the value returned by this method.

Returns: The CellSize, unless one or both of its width and height are Double.NaN or zero. If that is the case, it uses the width and/or height from the node's ResizeCellSize. But if one or both of the width and height are still Double.NaN or zero, it searches for a grid snapping node behind the AdornedNode, one that is DragOverSnapEnabled, and uses its DragOverSnapCellSize. If it cannot find such a grid snapping node, or one or both of the width and height are NaN, it uses the diagram's GridSnapCellSize if the diagram is GridSnapEnabled. Finally, it defaults to 1x1.

ComputeMaxSize
protected virtual Size ComputeMaxSize()
result = resizingTool.ComputeMaxSize()

The effective maximum resizing size is the minimum of MaxSize and the FrameworkElement's MaxWidth and MaxHeight.

Returns: the desired maximum Size during resizing

ComputeMinSize
protected virtual Size ComputeMinSize()
result = resizingTool.ComputeMinSize()

The effective minimum resizing size is the maximum of MinSize and the FrameworkElement's MinWidth and MinHeight.

Returns: the desired minimum Size during resizing

ComputeResize
protected virtual Rect ComputeResize(Point newPoint, Spot spot, Size min, Size max, bool reshape)
result = resizingTool.ComputeResize(newPoint, spot, min, max, reshape)

Given a Spot in the OriginalBounds and a new Point, compute the new Rect.

newPoint
a Point in model coordinates
spot
The Spot in the rectangular bounds for which the Handle is being dragged
min
the computed rectangle must be at least as large as these dimensions
max
the computed rectangle must be no larger than these dimensions
reshape
whether the aspect ratio of the rectangle may change
DoActivate
public override void DoActivate()
resizingTool.DoActivate()

Start resizing.

DoCancel
public override void DoCancel()
resizingTool.DoCancel()

Restore the OriginalBounds of the AdornedElement and stop this tool.

DoDeactivate
public override void DoDeactivate()
resizingTool.DoDeactivate()

This stops the current edit (StopTransaction).

DoMouseMove
public override void DoMouseMove()
resizingTool.DoMouseMove()

Call Rect) with a new bounds determined by the mouse point.

DoMouseUp
public override void DoMouseUp()
resizingTool.DoMouseUp()

Call Rect) with a rectangle based on the most recent mouse point, and raise an "object resized" event before stopping the tool.

DoResize
protected virtual void DoResize(Rect newr)
resizingTool.DoResize(newr)

Change the AdornedElement's Width and/or Height, and perhaps the AdornedNode's Location, given a new rectangular bounds for the adorned element.

newr
DoStart
public override void DoStart()
resizingTool.DoStart()

Capture the mouse when starting this tool.

DoStop
public override void DoStop()
resizingTool.DoStop()

Release the mouse capture when stopping this tool.

UpdateAdornments
public override void UpdateAdornments(Part part)
resizingTool.UpdateAdornments(part)

Show an Adornment with resize handles at points along the edge of bounds of the AdornedElement, if the node is selected and visible and if CanResize is true.

part

Fields

CellSizeProperty
public static readonly DependencyProperty CellSizeProperty
value = ResizingTool.CellSizeProperty

Identifies the CellSize dependency property.

MaxSizeProperty
public static readonly DependencyProperty MaxSizeProperty
value = ResizingTool.MaxSizeProperty

Identifies the MaxSize dependency property.

MinSizeProperty
public static readonly DependencyProperty MinSizeProperty
value = ResizingTool.MinSizeProperty

Identifies the MinSize dependency property.