- 积分
- 2943
- 明经币
- 个
- 注册时间
- 2003-11-3
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2003-11-10 11:01:00
|
显示全部楼层
我试改了一下程序,可以解决刚才我提的那个退出时会自动卸载原来菜单的问题。以下是修改部分。请大家指教。
Sub mainmenu()
On Error Resume Next
Dim newmenu As AcadPopupMenu
Dim newmenugroup As AcadMenuGroup
Dim newmenuitemname As AcadPopupMenuItem
Set newmenugroup = ThisDrawing.Application.MenuGroups.Item(0)
Set newmenu = newmenugroup.Menus.Add("坡度标注")
If Err Then
Err.Clear
n = Application.MenuGroups.Item(0).Menus.Count + 1
Application.MenuGroups.Item(0).Menus.InsertMenuInMenuBar "坡度标注", n
Exit Sub
End If
Set newmenuitemname = newmenu.AddMenuItem(newmenu.Count + 0, "相对X轴坡度", "-vbarun pd ")
Set newmenuitemname = newmenu.AddMenuItem(newmenu.Count + 1, "相对指定直线坡度", "-vbarun rj ")
Set newmenuitemname = newmenu.AddMenuItem(newmenu.Count + 2, "退出坡度标注程序", "-vbarun u2 ")
newmenu.InsertInMenuBar (ThisDrawing.Application.MenuBar.Count + 1)
End Sub
Sub u2()
'ThisDrawing.SendCommand "filedia 0 "
'ThisDrawing.SendCommand "menu " + Chr(13)
'ThisDrawing.SendCommand "filedia 1 "
On Error Resume Next
Application.MenuGroups.Item(0).Menus("坡度标注").RemoveFromMenuBar
End Sub |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
|