关于浮动和停靠工具栏 (VBA/ActiveX) 
工具栏可以通过编程方式停靠或浮动。 若要浮动工具栏,请使用工具栏的方法。该方法采用三个参数作为输入:Top、Left 和 NumberFloatRows。“顶部”和“左”参数指定工具栏顶部和左侧边缘的像素位置。NumberFloatRows 参数指定用于创建水平工具栏的行数。此数字必须等于或大于 1。工具栏的按钮将平均分布在指定的行数上。对于垂直对齐的工具栏,此值指定列数。FloatFloat 若要停靠工具栏,请使用工具栏的方法。该方法采用三个参数作为输入:Side、Row 和 Column。Side 参数指定将在停靠操作中定位的工具栏的一侧。您可以指定工具栏的顶部、底部、左侧或右侧。“行”和“列”参数指定停靠工具栏的现有行和列上的编号,该行和列将工具栏停靠在该行和列上。DockDock 可以使用该属性查询工具栏以查看它是否已停靠。如果工具栏停靠,则该属性将返回 TRUE,如果工具栏处于浮动状态,则返回 FALSE。DockStatusDockStatus 停靠工具栏本示例创建一个新工具栏,其中包含三个按钮。然后,工具栏将显示并停靠在屏幕左侧。 Sub Ch6_DockToolbar()
 Dim currMenuGroup As AcadMenuGroup
 Set currMenuGroup = ThisDrawing.Application. _
 MenuGroups.Item(0)
 ' Create the new toolbar
 Dim newToolbar As AcadToolbar
 Set newToolbar = currMenuGroup.Toolbars. _
 Add("TestToolbar")
 ' Add three buttons to the new toolbar.
 ' All three buttons will have the same macro attached.
 Dim newButton1 As AcadToolbarItem
 Dim newButton2 As AcadToolbarItem
 Dim newButton3 As AcadToolbarItem
 Dim openMacro As String
 ' Assign the macro the VB equivalent of "ESC ESC _open "
 openMacro = Chr(3) + Chr(3) + "_open "
 Set newButton1 = newToolbar.AddToolbarButton _
 ("", "NewButton1", "Open a file.", openMacro)
 Set newButton2 = newToolbar.AddToolbarButton _
 ("", "NewButton2", "Open a file.", openMacro)
 Set newButton3 = newToolbar.AddToolbarButton _
 ("", "NewButton3", "Open a file.", openMacro)
 ' Display the toolbar
 newToolbar.Visible = True
 ' Dock the toolbar to the left of the screen.
 newToolbar.Dock acToolbarDockLeft
End Sub
 | 
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1   苏公网安备32011402011833)
GMT+8, 2025-11-4 15:14
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.