右键单击菜单或快捷菜单是包含在 AutoCAD 基本菜单组中的特殊菜单。当用户按住 Shift 键并单击鼠标右键时,将显示此菜单。 AutoCAD 通过在基本菜单组中查找属性等于 TRUE 的菜单来查找快捷菜单。ShortcutMenu 新菜单组可能有也可能没有可用的快捷菜单。若要为菜单组创建快捷菜单,请创建一个新菜单,并使用 POP0 作为新菜单的标签。 在右键单击菜单的末尾添加菜单项本示例将菜单项“OpenDWG”添加到右键单击菜单的末尾。 Sub Ch6_AddMenuItemToshortcutMenu() Dim currMenuGroup As AcadMenuGroup Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0) ' Find the shortcut menu and assign it to the ' shortcutMenu variable Dim scMenu As AcadPopupMenu Dim entry As AcadPopupMenu For Each entry In currMenuGroup.Menus If entry.shortcutMenu = True Then Set scMenu = entry End If Next entry ' Add a menu item to the shortcut menu Dim newMenuItem As AcadPopupMenuItem Dim openMacro As String ' Assign the macro the VBA equivalent of "ESC ESC _open " openMacro = Chr(3) + Chr(3) + "_open " Set newMenuItem = scMenu.AddMenuItem _ ("", Chr(Asc("&")) _ + "OpenDWG", openMacro) End Sub |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:29
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.