Nevron Open Vision Documentation
Diagram / Diagram DOM / Drawings / Pages / Page Selection
In This Topic
    Page Selection
    In This Topic

    NOV Diagram for .NET lets you easily select one, more or all diagram items in a drawing page. To select/deselect shapes use the page's Selection property.

     Selecting Shapes

    The page's Selection object provides the following methods for selecting shapes and other diagram items.

    • SingleSelect - makes the specified item or list of items the only selected items.
    • MultiSelect - appends the given item or list of items to the current page selection without removing the currently selected items.
    • ToggleSelect - toggles the selection of the given item or list of items, i.e. if the items were not selected, this method selects them and vice versa.
    • SelectAll - selects all 1D, all 2D or all shapes in the page based on the specified parameter.

    The following code shows how to select all 2D shapes in a page:

    Select all 2D shapes
    Copy Code
    NPage page = drawingView.ActivePage;
     Deselecting Shapes

    To deselect shapes, use the following method of the shape:

    • Deselect - deselects one or more diagram items.
    • DeselectAll - deselects all diagram items.
     Other Selection Properties and Methods

    The page selection provides the following properties:

    • Mode - defines the selection mode. Can be Single or Multiple.
    • SelectedCount - gets the number of currently selected items.
    • SelectedItems - gets the list of currently selected items.
    • HasShapes - indicates whether the page selections contains any shapes.
    • AlignmentAnhor - gets the node towards which alignment commands are executed.
    • AlignmentAnchorMode - defines the alignment anchor mode. By default the last selected shape is the alignment anchor.
    • FormatAnchor - gets the node towards which formatting commands are executed.
    • FormatAnchorMode - defines the formatting anchor mode. By default the last selected shape is the format anchor.
    • BatchDelete - gets a batch, whose Delete method can be used to delete all currently selected shapes.
    • BatchGroup - gets a batch, whose Group method can be used to group all currently selected shapes.

    The page selection also provides the following methods:

    • IsSelected - check whether the given diagram item is selected.
    • GetBounds - gets the selection bounds in page coordinates.