工具栏可以通过编程方式停靠或浮动。 若要浮动工具栏,请使用工具栏的方法。该方法将三个参数作为输入:顶部、左侧和数字浮动行。顶部和左侧参数指定工具栏上边缘和左边缘的像素位置。参数指定用于创建水平工具栏的行数。此数字必须等于或大于 1。工具栏的按钮将平均分布在指定的行数上。对于垂直对齐的工具栏,此值指定列数。FloatFloat 若要停靠工具栏,请使用工具栏的方法。该方法将三个参数作为输入:侧、行和列。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 )
GMT+8, 2024-5-27 09:05
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.