Table of Contents

Class DrawCommandHandler

Namespace
Northwoods.Go.Extensions
Assembly
DrawCommandHandlerWinForms.dll

This CommandHandler class allows the user to position selected Parts in a diagram relative to the first part selected, in addition to overriding the DoKeyDown method of the CommandHandler for handling the arrow keys in additional manners.

public class DrawCommandHandler : CommandHandler
Inheritance
DrawCommandHandler
Inherited Members

Properties

ArrowKeyBehavior

Gets or sets the arrow key behavior. Possible values can be found in the ArrowBehavior enum.

public ArrowBehavior ArrowKeyBehavior { get; set; }

Property Value

ArrowBehavior

Remarks

The default value is Move.

PasteOffset

Gets or sets the offset at which each repeated PasteSelection(Point?) puts the new copied parts from the clipboard.

public Point PasteOffset { get; set; }

Property Value

Point

Remarks

The default value is (10, 10).

Methods

AlignBottom()

Aligns selected parts along the bottom-most edge of the bottom-most part.

public void AlignBottom()

AlignCenterX()

Aligns selected parts at the x-value of the center point of the first selected part.

public void AlignCenterX()

AlignCenterY()

Aligns selected parts at the y-value of the center point of the first selected part.

public void AlignCenterY()

AlignColumn(int)

Aligns selected parts top-to-bottom in order of the order selected.

public void AlignColumn(int distance = 0)

Parameters

distance int

Remarks

Distance between parts can be specified. Default distance is 0.

AlignLeft()

Aligns selected parts along the left-most edge of the left-most part.

public void AlignLeft()

AlignRight()

Aligns selected parts along the left-most edge of the left-most part.

public void AlignRight()

AlignRow(int)

Aligns selected parts left-to-right in order of the order selected.

public void AlignRow(int distance = 0)

Parameters

distance int

Remarks

Distance between parts can be specified. Default distance is 0.

AlignTop()

Aligns selected parts along the top-most edge of the top-most part.

public void AlignTop()

CanAlignSelection()

This controls whether or not the user can invoke the AlignLeft(), AlignRight(), AlignTop(), AlignBottom(), AlignCenterX(), AlignCenterY() commands.

public bool CanAlignSelection()

Returns

bool

This returns true: if the diagram is not IsReadOnly, if the model is not IsReadOnly, if there are at least two selected Parts.

CanRotate()

This controls whether or not the user can invoke the Rotate(double) method.

public bool CanRotate()

Returns

bool

This returns true: if the diagram is not IsReadOnly, if the model is not IsReadOnly, if there is at least one selected Parts.

CopyToClipboard(IEnumerable<Part>)

Reset the last offset for pasting.

public override void CopyToClipboard(IEnumerable<Part> coll)

Parameters

coll IEnumerable<Part>

DoKeyDown()

This implements custom behaviors for arrow key keyboard events.

public override void DoKeyDown()

Remarks

Set ArrowKeyBehavior to select, move, scroll, or none This affects the behavior when a user types an arrow key.

PasteFromClipboard()

Paste from the clipboard with an offset incremented on each paste, and reset when copied.

public override IReadOnlyCollection<Part> PasteFromClipboard()

Returns

IReadOnlyCollection<Part>

a collection of newly pasted Parts

PullToFront()

Change the z-ordering of selected parts to pull them forward, in front of all other parts in their respective layers.

public void PullToFront()

Remarks

All unselected parts in each layer with a selected Part with a non-numeric ZOrder will get a ZOrder of 0.

PushToBack()

Change the z-ordering of selected parts to push them backward, behind all other parts in their respective layers.

public void PushToBack()

Remarks

All unselected parts in each layer with a selected Part with a non-numeric ZOrder will get a ZOrder of 0.

Rotate(double)

Change the angle of the parts connected with the given part.

public void Rotate(double angle = 90)

Parameters

angle double

the positive (clockwise) or negative (counter-clockwise) change in the angle of each Part, in degrees.

Remarks

This is in the command handler so it can easily be accessed for the purpose of creating commands that change the rotation of parts.