Back to Devexpress

DiagramControl.SelectItem(DiagramItem, ModifySelectionMode) Method

windowsforms-devexpress-dot-xtradiagram-dot-diagramcontrol-dot-selectitem-x28-devexpress-dot-xtradiagram-dot-diagramitem-devexpress-dot-diagram-dot-core-dot-modifyselectionmode-x29.md

latest2.9 KB
Original Source

DiagramControl.SelectItem(DiagramItem, ModifySelectionMode) Method

Selects the specified diagram item.

Namespace : DevExpress.XtraDiagram

Assembly : DevExpress.XtraDiagram.v25.2.dll

NuGet Package : DevExpress.Win.Diagram

Declaration

csharp
public void SelectItem(
    DiagramItem item,
    ModifySelectionMode modifySelectionMode = ModifySelectionMode.ReplaceSelection
)
vb
Public Sub SelectItem(
    item As DiagramItem,
    modifySelectionMode As ModifySelectionMode = ModifySelectionMode.ReplaceSelection
)

Parameters

NameTypeDescription
itemDiagramItem

A DiagramItem object that is the item to select.

|

Optional Parameters

NameTypeDefaultDescription
modifySelectionModeModifySelectionModeReplaceSelection

A ModifySelectionMode enumeration value that specifies whether to add or replace the existing selection with the specified diagram item.

|

Remarks

The following code sample demonstrates how to use the SelectItem method to select a newly added shape:

csharp
private void button1_Click(object sender, EventArgs e) {
    DiagramShape diagramShape = new DiagramShape();
    diagramShape.Shape = BasicFlowchartShapes.Decision;
    diagramShape.Size = new SizeF(200, 200);
    diagramShape.Position = new DevExpress.Utils.PointFloat(450, 300);

    diagramControl1.Items.Add(diagramShape);
    diagramControl1.SelectItem(diagramShape, ModifySelectionMode.ReplaceSelection);
}
vb
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim diagramShape As DiagramShape = New DiagramShape()
    diagramShape.Shape = BasicFlowchartShapes.Decision
    diagramShape.Size = New SizeF(200, 200)
    diagramShape.Position = New DevExpress.Utils.PointFloat(450, 300)

    diagramControl1.Items.Add(diagramShape)
    diagramControl1.SelectItem(diagramShape, ModifySelectionMode.ReplaceSelection)
End Sub

See Also

DiagramControl Class

DiagramControl Members

DevExpress.XtraDiagram Namespace