miaozx2000 发表于 2011-6-3 16:48:31

如何用C# 实现CAD添加菜单?

大侠们,如何用C# 实现CAD添加菜单?菜单下包含二级菜单呢??

miaozx2000 发表于 2011-6-3 16:59:23

Autodesk.AutoCAD.Interop.AcadPopupMenu popMenu;

public static void mymenu()
{
   Autodesk.AutoCAD.Interop.AcadApplication acadApp=Autodesk.AutoCAD.ApplicationServices.Application.AcadApplication as Autodesk.AutoCAD.Interop.AcadApplication;
            try
            {
                popMenu = acadApp.MenuGroups.Item(0).Menus.Add("我的菜单");
                Autodesk.AutoCAD.Interop.AcadPopupMenuItem popItem0 = popMenu.AddMenuItem(0, "设置地形图目录", "_setmappath ");
                Autodesk.AutoCAD.Interop.AcadPopupMenuItem popItem1 = popMenu.AddMenuItem(1, "查询图号", "_shoumapname ");
                Autodesk.AutoCAD.Interop.AcadPopupMenuItem popItem2 = popMenu.AddMenuItem(2, "插入地形图", "_insertMap ");
                //Autodesk.AutoCAD.Interop.AcadPopupMenuItem popItem3 = popMenu.AddMenuItem(3, "查询图号", "_sssss ");
          popMenu.InsertInMenuBar(11);
            }
            catch (Autodesk.AutoCAD.Runtime.Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }

miaozx2000 发表于 2011-6-3 16:59:55

如何添加二级菜单呢??
页: [1]
查看完整版本: 如何用C# 实现CAD添加菜单?