Visual Basic (Declaration) | |
---|---|
Public Sub CenterRect( _ ByVal bounds As Rect, _ ByVal afterwards As Action _ ) |
C# | |
---|---|
public void CenterRect( Rect bounds, Action afterwards ) |
Parameters
- bounds
- a
Rect
in model coordinates - afterwards
- an
Action
to be performed after the animation is finished; may be null
The HorizontalContentAlignment and VerticalContentAlignment properties need to be "Stretch" if the DiagramPanel.DiagramBounds are smaller than the viewport. But in any case, the bounds might not be centered if the panel cannot be scrolled far enough.
If you want to try to center the selection in the viewport, call:
myDiagram.Panel.CenterRect(myDiagram.Panel.ComputeBounds(myDiagram.SelectedParts), null);