CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ObjectARX 开发指南

应用程序菜单 (.NET)

2023-1-1 08:22| 发布者: admin| 查看: 1165| 评论: 0|来自: AutoCAD

摘要: 您可以通过修改 Windows 注册表设置来自定义菜单项并将其添加到应用程序菜单,以满足您的开发要求。

您可以通过修改 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"

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-19 15:27

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部