您可以通过修改 Windows 注册表设置来自定义菜单项并将其添加到应用程序菜单中,以满足您的开发要求。 应用程序按钮的内容是从 .xaml 文件加载的。您可以在注册表中找到该文件: [HKEY_LOCAL_MACHINE\software\Autodesk\AutoCAD\R24.0\ACAD-4101\Variables\APPFRAMERESOURCES] 该文件的默认位置是“pack://application:,,,/AcWindows;component/AppFrame/AcAppFrame.xaml“。 可以使用注册表扩展应用程序菜单。读取注册表项并添加指定的菜单项。 注意:应用程序菜单没有用于管理和修改其项目的客户用户界面 (CUI) API。
下面的代码示例演示如何向 AppMenu 添加两个菜单项(菜单和子菜单)。“菜单”项显示为 Vaac,子菜单显示为 VaacCheckIn。自定义菜单项 Vaac 插入到“发布”菜单项之后,VaacCheckIn 是父菜单中的子菜单项。可以在文本输入字段中设置菜单项名称,该字段也可以指向本地化的资源 DLL。例如,或 .Text="menuitem"Text="xyz.dll,104" /* Determines ApplicationMenuItem.Id of the newly created item. */ [HKEY_CURRENT_USER\<ProductRegRoot>\Profiles\<CurrentProfile>ApplicationMenu\vaacMenu] /* Determines where the new item will be inserted. Supported values are InsertBefore and InsertAfter. AcPublish is the Id of an existing item.*/ "InsertBefore"="AcPublish" /* ApplicationMenuItem.LargeImage is initialized with this value*/ "Image"="pack://.." /* Determines whether you want to insert a separator after the item. This is optional. Supported values are "After" and "Before". */ "Separator"="After" /* ApplicationMenuItem.Text is initialized with this value. The value can be literal string (which need to be localized) or reference to managed or unmanaged resource string. */ "Text"="vaacres.dll,101" /* ApplicationMenuItem.CommandParameter is initialized with this value. This is optional. If it is not specified then this menu must have submenus. If Command is not specified and there are no subkeys then we should not create an ApplicationMenuItem. If both Command and subkeys are present then we should create an ApplicationMenuItem with the IsSplit property set to "true". */ "Command"="_vaacManager" /* Nesting implies that this menu item is a submenu. */ [HKEY_CURRENT_USER\<ProductRegRoot> \Profiles\<CurrentProfile>\Application Menu\vaacMenu\vaacCheckIn] "Image"="pack://.." "Text"="vaacres.dll,102" "Command"="_vaacCheckIn" |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:23
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.