Partager via


Window.CenterViewOnShape Method (Visio)

Pans the Microsoft Visio drawing window to place the specified shape in the center of the view.

Version Information

Version Added: Visio 2010

Syntax

expression .CenterViewOnShape(SheetObject, Flags)

expression A variable that represents a Window object.

Parameters

Name

Required/Optional

Data Type

Description

SheetObject

Required

Shape

The shape to center in the view.

Flags

Required

VisCenterViewFlags

The centering behavior to apply.

Return Value

Nothing

Remarks

The Flags parameter value must be combination of one of more of the following VisCenterViewFlags constants.

Constant

Value

Description

visCenterViewDefault

0

Display the page that contains the specified shape and center the view on the shape.

visCenterViewIfOffScreen

1

Center the view only if the shape is currently off screen.

visCenterViewSelectShape

2

Also select the shape.

If the specified shape is not valid, Microsoft Visio returns an Invalid Parameter error.