Toolbar.Top 属性 (Visio)

获取对象顶部与停靠区域顶部或屏幕顶部(如果对象未停靠)之间的距离;它设置 Toolbar 对象顶部与屏幕顶部之间的距离。 读/写。

语法

表达式返回页首

表达 一个代表 Toolbar 对象的变量。

返回值

整数

示例

以下示例说明如何使用 Top 属性设置 UIObject 对象的位置。 该示例将一个自定义工具栏添加到复制的工具栏集合。 该工具栏出现在 Microsoft Visio 用户界面中,并且在文档处于活动状态时可用。

运行此宏后,要恢复 Visio 的内置工具栏,请调用 ThisDocument.ClearCustomToolbars 方法。

 
Public Sub Top_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) 
 
 Else 
 
 'If there are application custom toolbars, clone them. 
 Set vsoUIObject = Visio.Application.CustomToolbars.Clone 
 
 End If 
 
 Else 
 
 '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( _ 
 Visio.visUIObjSetDrawing).Toolbars 
 
 '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 
 
 End With 
 
 'Use the custom toolbars in this document. 
 ThisDocument.SetCustomToolbars vsoUIObject 
 
End Sub

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。