Table of contents
TOC
折叠目录
展开目录

Page.ObjectType 属性 (Visio)Page.ObjectType Property (Visio)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

返回对象的类型。只读。Returns an object's type. Read-only.

语法Syntax

表达式对象类型expression . ObjectType

表达式_一个表示一个Page对象的变量。_expression A variable that represents a Page object.

返回值Return Value

IntegerInteger

注解Remarks

表示对象类型的常数为visObjType前缀,由VisObjectTypes在 Visio 类型库声明的。Constants representing object types are prefixed with visObjType and are declared by the Visio type library in VisObjectTypes .

示例Example

此示例演示如何使用页的对象类型属性可以循环通过一组以递归的方式,并确定最上面的形状。This example shows how to use the ObjectType property of a page to iterate recursively through a group and identify the top shape.

Public Sub ObjectType_Example() 

 Dim vsoShape As Visio.Shape 
 Dim vsoShapes As Visio.Shapes 
 Dim vsoPage As Visio.Page 

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Pentagon"), 3#, 8.5 

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Ellipse"), 3#, 7.625 

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Rounded rectangle"), 3#, 7# 

 Application.ActiveWindow.Page.Drop Application.Documents.Item("BASIC_U.VSS").Masters.ItemU("Circle"), 3#, 6.25 

 Application.ActiveWindow.SelectAll 

 ActiveWindow.DeselectAll 
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Circle"), visSelect 
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Rounded rectangle"), visSelect 
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Ellipse"), visSelect 
 ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemU("Pentagon"), visSelect 
 ActiveWindow.Selection.Group 

 Set vsoPage = ActivePage 
 Set vsoShapes = vsoPage.Shapes 
 Set vsoShape = vsoShapes.Item(2) 

 Call GetTopShape(vsoShape) 

End Sub 

Function GetTopShape(vsoShape As Visio.Shape) As String 

 Dim vsoShapeParent As Object 
 Dim vsoShapeParentParent As Object 

 Set vsoShapeParent = vsoShape.Parent 

 If vsoShapeParent.ObjectType = visObjTypeShape Then 

 Set vsoShapeParentParent = vsoShapeParent.Parent 

 'If vsoShapeParent's parent isn't a page, keep going up. 
 If vsoShapeParentParent.ObjectType = visObjTypePage Then 
 GetTopShape = vsoShapeParent.Name 
 Else 
 GetTopShape = GetTopShape(vsoShapeParent) 
 End If 

 End If 

 Debug.Print vsoShapeParent.Name 

End Function
© 2018 Microsoft