weihedao 发表于 2008-1-8 11:04:00

能否新建一个菜单条?

如题,如何创建菜单条

chtd 发表于 2008-1-8 21:43:00

可以编辑acad.mns文件,也可以在cad工具条处右击,在弹出的对话框中,拖动一个命令到工具栏处。

azjmjsj 发表于 2008-1-8 23:51:00

本帖最后由 作者 于 2008-1-9 13:01:48 编辑 <br /><br /> <p>Sub addmenu()<br/>Dim currMenuGroup As AcadMenuGroup<br/>Dim newMenu As AcadPopupMenu<br/>On Error Resume Next</p><p>'建立新菜单<br/>Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)<br/>Set newMenu = currMenuGroup.Menus.Add("custom_menu")</p><p>'增加菜单项<br/>Dim newMenuitem As AcadPopupMenuItem<br/>Dim Macrostr(4) As String<br/>Macrostr(1) = Chr(3) &amp; Chr(3) &amp; Chr(95) &amp; "-vbarun ""aaa.dvb!ddd""" &amp; Chr(32)<br/>Macrostr(2) = Chr(3) &amp; Chr(3) &amp; Chr(95) &amp; "-vbarun ""bbb.dvb!eee""" &amp; Chr(32)<br/>Macrostr(3) = Chr(3) &amp; Chr(3) &amp; Chr(95) &amp; "-vbarun ""ccc.dvb!fff""" &amp; Chr(32)<br/>Macrostr(4) = Chr(3) &amp; Chr(3) &amp; "(startapp " &amp; Chr(34) &amp; "ggg.exe" &amp; Chr(34) &amp; ")" &amp; Chr(13)<br/>Set newMenuitem = newMenu.AddMenuItem(newMenu.Count + 1, "菜单一", Macrostr(1))<br/>newMenuitem.HelpString = "菜单一"&nbsp; ' 为菜单项增加状态栏帮助<br/>Set newMenuitem = newMenu.AddMenuItem(newMenu.Count + 1, "菜单二", Macrostr(2))<br/>newMenuitem.HelpString = "菜单二"<br/>Set newMenuitem = newMenu.AddMenuItem(newMenu.Count + 1, "菜单三", Macrostr(3))<br/>newMenuitem.HelpString = "菜单三"<br/>Set newMenuitem = newMenu.AddSeparator(3)&nbsp;&nbsp; '菜单分隔符<br/>Set newMenuitem = newMenu.AddMenuItem(newMenu.Count + 1, "菜单四", Macrostr(4))<br/>newMenuitem.HelpString = "******制作"</p><p>If Err.Number Then Err.Clear</p><p>'菜单条上显示菜单<br/>currMenuGroup.Menus.InsertMenuInMenuBar "custom_menu", 8<br/>End Sub<br/><br/>****************************************************************************<br/>西北凡人------<a href="http://www.abofanyi.com/blog">http://www.abofanyi.com/blog</a></p><p></p><p></p>
页: [1]
查看完整版本: 能否新建一个菜单条?