Table of contents

ToolbarItem.Visible 属性 (Visio)ToolbarItem.Visible Property (Visio)

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

确定对象是否可见。读/写。Determines whether an object is visible. Read/write.


表达式可见expression . Visible

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

返回值Return Value



此示例演示如何使用Visible属性来确定UIObject对象在用户界面中是否可见。该示例向克隆的 toolbars 集合添加一个自定义工具栏。该工具栏出现在 Microsoft Visio 用户界面和文档处于活动状态时可以使用。This example shows how to use the Visible property to determine if a UIObject object is visible in the user interface. The example adds a custom toolbar to the cloned toolbars collection. This toolbar appears in the Microsoft Visio user interface and is available while the document is active.

若要运行该宏后,请还原内置 Visio 工具栏,调用ThisDocument.ClearCustomToolbars方法。To restore the built-in Visio toolbars after you run this macro, call the ThisDocument.ClearCustomToolbars method.

Public Sub Visible_Example() 

 Dim vsoUIObject As Visio.UIObject 
 Dim vsoToolbars As Visio.Toolbars 
 Dim vsoToolbar As Visio.Toolbar 

 'Check whether there are document custom toolbars. 
 If ThisDocument.CustomToolbars Is Nothing Then 

 'If not, check whether there are application custom toolbars. 
 If Visio.Application.CustomToolbars Is Nothing Then 

 'If not, use the built-in toolbars. 
 Set vsoUIObject = Visio.Application.BuiltInToolbars(0) 


 'If there are application custom toolbars, clone them. 
 Set vsoUIObject = Visio.Application.CustomToolbars.Clone 

 End If 


 'If there are custom toolbars in the document, use them. 
 Set vsoUIObject = ThisDocument.CustomToolbars 

 End If 

 'Get the Toolbars collection for the drawing window context. 
 Set vsoToolbars = vsoUIObject.ToolbarSets.ItemAtID( _ 

 'Add a toolbar to the collection. 
 Set vsoToolbar = vsoToolbars.Add 
 With vsoToolbar 

 'Set the title of the toolbar. 
 .Caption = "My New Toolbar" 

 'Float the toolbar at coordinates (300,200). 
 .Position = Visio.visBarFloating 
 .Left = 300 
 .Top = 200 

 'Make the toolbar visible. 
 .Visible = True 

 End With 

 'Use the custom toolbars in this document. 
 ThisDocument.SetCustomToolbars vsoUIObject 

End Sub
© 2018 Microsoft