能否新建一个菜单条?
如题,如何创建菜单条 可以编辑acad.mns文件,也可以在cad工具条处右击,在弹出的对话框中,拖动一个命令到工具栏处。 本帖最后由 作者 于 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) & Chr(3) & Chr(95) & "-vbarun ""aaa.dvb!ddd""" & Chr(32)<br/>Macrostr(2) = Chr(3) & Chr(3) & Chr(95) & "-vbarun ""bbb.dvb!eee""" & Chr(32)<br/>Macrostr(3) = Chr(3) & Chr(3) & Chr(95) & "-vbarun ""ccc.dvb!fff""" & Chr(32)<br/>Macrostr(4) = Chr(3) & Chr(3) & "(startapp " & Chr(34) & "ggg.exe" & Chr(34) & ")" & Chr(13)<br/>Set newMenuitem = newMenu.AddMenuItem(newMenu.Count + 1, "菜单一", Macrostr(1))<br/>newMenuitem.HelpString = "菜单一" ' 为菜单项增加状态栏帮助<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) '菜单分隔符<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]