Shapes
- 2 minutes to read
Shapes are basic elements of the DiagramControl. End-users can add shapes to the diagram canvas using the DiagramDesignerControl, which provides the Shapes Panel displaying all available shapes.
Shapes are encapsulated by DiagramShape class objects. The size and position of shapes can be specified with the Width, Height, and Position properties. To specify the shape kind in code, use the DiagramShape.Shape property.
DiagramShape diagramShape = new DiagramShape();
diagramShape.Shape = DevExpress.Diagram.Core.BasicFlowchartShapes.Decision;
Shape operations
Selection
Click a shape to select it. To select multiple shapes, hold the CTRL or SHIFT key and click each shape you want to select. Alternatively, click on the canvas and drag to create a selection rectangle around the shapes you want to select. To select all shapes in the page, press CTRL+A key combination. The selected shapes are outlined by a rectangle with selection handles. To deselect a shape, hold the CTRL or SHIFT key and click it. To deselect all shapes, press the ESC key.
Moving
To move the selected shape/shapes, drag it using the mouse or press arrow keys.
Resizing
To resize the selected shape or multiple shapes, drag one of the selection handles. By default, dragging corner selection handles resizes the container proportionally. To change the aspect ratio, hold the SHIFT key while dragging a corner selection handle or drag one of the side selection handles. To disable the proportional resizing, set the DiagramControl.EnableProportionalResizing to false.
Copying
To copy the selected shape or multiple shapes, drag it while holding the CTRL key or press the CTRL+C key combination to copy the selection to clipboard and then press the CTRL+V key combination to paste the clipboard content to the canvas.
Rotation
To rotate the selected shape or multiple shapes, drag the rotation handle.
Transformation
Certain shapes display yellow handles when selected. These shapes can be transformed by dragging these handles.
Editing text
Double-click a shape to enter the text editing mode. To accept changes, press the ESC key or click anywhere on the canvas.
Expanding/collapsing subordinate items
Click the expand-collapse button below a shape to show or hide the subordinate items.