共用方式為


GetBounds (StrokeCollection)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Returns a Rect that is the bounding box of the strokes in the collection.

retval = object.GetBounds()

Return Value

Type: Rect

The bounding box of the strokes in the StrokeCollection.

Managed Equivalent

GetBounds

Remarks

Do not attempt to set values in the returned Rect; it should be used for reference only.

Example

var newRect = inkPresenter.Strokes.GetBounds();

For the strokes shown in the following illustration that render the word "Ink!", the Rect that would be returned by calling the GetBounds method is the red box.

Bounding box

The bounding box of an inkcanvas

Scenarios for this method include using the returned Rect as input for a RectangleGeometry that will display the bounding box in the user interface, or checking for intersecting strokes or other types of hit-testing.

Applies To

StrokeCollection