Exemplo n.º 1
0
    public void AddCustomMenu()
    {
        ContextMenuExtension obj = new ContextMenuExtension
        {
            Title = "自定义菜单"
        };
        MenuItem menuItem = new MenuItem("批量生成Dxf文件");

        menuItem.Click += mi_Click;
        MenuItem menuItemDwg = new MenuItem("批量生成Dwg文件");

        menuItemDwg.Click += miDwg_Click;
        MenuItem menuItemPline = new MenuItem("批量生成多段线门Dxf");

        menuItemPline.Click += menuItemPline_Click;
        MenuItem menuItemPlineDWG = new MenuItem("批量生成多段线门DWG");

        menuItemPlineDWG.Click += menuItemPlineDWG_Click;
        MenuItem settingItem = new MenuItem("设置");

        settingItem.Click += settingItem_Click;
        obj.MenuItems.Add(menuItem);
        obj.MenuItems.Add(menuItemDwg);
        obj.MenuItems.Add(menuItemPline);
        obj.MenuItems.Add(menuItemPlineDWG);
        obj.MenuItems.Add(settingItem);
        Autodesk.AutoCAD.ApplicationServices.Application.AddDefaultContextMenuExtension(obj);
    }
Exemplo n.º 2
0
        private void AddContextMenu()
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

            try
            {
                contextMenu       = new ContextMenuExtension();
                contextMenu.Title = "Aerials";

                // Insert Aerial button
                MenuItem insertAerialMI = new MenuItem("Insert Aerial");
                insertAerialMI.Click += InsertAerialCallback;

                // Update Aerial button
                MenuItem updateAerialMI = new MenuItem("Update Aerial");
                updateAerialMI.Click += UpdateAerialCallback;

                contextMenu.MenuItems.Add(insertAerialMI);
                contextMenu.MenuItems.Add(updateAerialMI);

                Application.AddDefaultContextMenuExtension(contextMenu);
            } catch (Exception ex)
            {
                ed.WriteMessage("Error adding context menu: " + ex.Message + '\n');
            }
        }
Exemplo n.º 3
0
        AddContextMenu()
        {
            m_appMenu       = new ContextMenuExtension();
            m_appMenu.Title = "MgdDbg";

            m_appMenu.MenuItems.Add(new AppContextMenuItem("Snoop Entities...", "MgdDbgSnoopEnts"));
            m_appMenu.MenuItems.Add(new AppContextMenuItem("Snoop Entities (nested)...", "MgdDbgSnoopNEnts"));
            m_appMenu.MenuItems.Add(new AppContextMenuItem("Snoop (by Handle)...", "MgdDbgSnoopByHandle"));
            m_appMenu.MenuItems.Add(new AppContextMenuItem("Snoop Database...", "MgdDbgSnoopDb"));
            m_appMenu.MenuItems.Add(new AppContextMenuItem("Snoop Editor...", "MgdDbgSnoopEd"));
            m_appMenu.MenuItems.Add(new MenuItem(""));    // separator
            m_appMenu.MenuItems.Add(new AppContextMenuItem("Events...", "MgdDbgEvents"));
            m_appMenu.MenuItems.Add(new MenuItem(""));    // separator
            m_appMenu.MenuItems.Add(new AppContextMenuItem("Test Framework...", "MgdDbgTests"));

            foreach (MenuItem mnuItem in m_appMenu.MenuItems)
            {
                AppContextMenuItem appContextMnuItem = mnuItem as AppContextMenuItem;
                if (appContextMnuItem != null)
                {
                    appContextMnuItem.Click += new EventHandler(ExecuteCommand);
                }
            }

            Application.AddDefaultContextMenuExtension(m_appMenu);
        }
Exemplo n.º 4
0
        private static void cme_Popup(object sender, EventArgs e)
        {
            ContextMenuExtension cme = (ContextMenuExtension)sender;
            Document             doc = Application.DocumentManager.MdiActiveDocument;
            Editor ed = doc.Editor;
            PromptSelectionResult selImplRes = ed.SelectImplied();

            cme.MenuItems.Clear();

            if (selImplRes.Status != PromptStatus.OK)
            {
                return;
            }
            var selIds = selImplRes.Value.GetObjectIds();

            if (selIds.Count() > 0)
            {
                MenuItem miOn = new MenuItem("Включить Бергштрихи");
                miOn.Click += ActivateIsolines;
                cme.MenuItems.Add(miOn);

                MenuItem miOff = new MenuItem("Отключить Бергштрихи");
                miOff.Click += UnActivateIsolines;
                cme.MenuItems.Add(miOff);

                MenuItem miReverse = new MenuItem("Отразить Бергштрихи");
                miReverse.Click += ReverseIsolines;
                cme.MenuItems.Add(miReverse);
            }
        }
            public static void Attach()
            {
                if (ContextMenu == null)
                {
                    if (File.Exists(UserConfigFile.FullFileName))
                    {
                        var configXml     = UserConfigFile.ConfigFileXml;
                        var settingsXml   = configXml?.Element("Settings");
                        var fastBlocksXml = settingsXml?.Element("mpFastBlocks");
                        if (fastBlocksXml != null)
                        {
                            if (fastBlocksXml.Elements("FastBlock").Any())
                            {
                                ContextMenu = new ContextMenuExtension {
                                    Title = Language.GetItem(LangItem, "h50")
                                };
                                foreach (var fbXml in fastBlocksXml.Elements("FastBlock"))
                                {
                                    var mi = new MenuItem(fbXml.Attribute("Name").Value);
                                    mi.Click += Mi_Click;
                                    ContextMenu.MenuItems.Add(mi);
                                }

                                Application.AddDefaultContextMenuExtension(ContextMenu);
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show(Language.GetItem(LangItem, "err4"), MessageBoxIcon.Close);
                    }
                }
            }
Exemplo n.º 6
0
        /*[CommandMethod("BEdit")]
         * public void BlockEditer()
         * {
         *  ContextMenuExtension ce = new ContextMenuExtension();
         *  ce.Title = "编辑块定义";
         *  MenuItem mil=new MenuItem("定义块")
         * }
         */

        public void Initialize()
        {
            ContextMenuExtension ce = new ContextMenuExtension();

            ce.Title = "编辑块定义";
            MenuItem mil = new MenuItem("定义块")
        }
 public static void Detach()
 {
     if (ContextMenu != null)
     {
         Application.RemoveDefaultContextMenuExtension(ContextMenu);
         ContextMenu = null;
     }
 }
Exemplo n.º 8
0
 public static void Attach()
 {
    cme = new ContextMenuExtension();
    cme.Popup += cme_Popup;
             
    RXClass rxc = Entity.GetClass(typeof(Curve));
    Application.AddObjectContextMenuExtension(rxc, cme);
 }
Exemplo n.º 9
0
 /// <summary>移除菜单项
 ///
 /// </summary>
 private void RemoveContextMenu()
 {
     if (m_ContextMenu != null)
     {
         Application.RemoveDefaultContextMenuExtension(m_ContextMenu);
         m_ContextMenu = null;
     }
 }
Exemplo n.º 10
0
 private void RemoveContextMenu()
 {
     if (m_ContextMenu != null)
     {
         Autodesk.AutoCAD.ApplicationServices.Application.RemoveDefaultContextMenuExtension(m_ContextMenu);
         m_ContextMenu = null;
     }
 }
Exemplo n.º 11
0
 private void RemoveContextMenu()
 {
     if (m_ContextMenu != null)
     {
         Autodesk.AutoCAD.ApplicationServices.Application.RemoveDefaultContextMenuExtension(m_ContextMenu);
         m_ContextMenu = null;
     }
 }
Exemplo n.º 12
0
        public void Test()
        {
            DocumentCollection acDocColl = Application.DocumentManager;

            Editor acEd = Application.DocumentManager.MdiActiveDocument.Editor;

            Window wind = Application.MainWindow;

            AcadApplication acadApplication = Application.AcadApplication as AcadApplication;

            AcadMenuBar acadMenuBa = Application.MenuBar as AcadMenuBar;

            ContextMenuExtension acCtxMenuExten = new ContextMenuExtension();


            /*Document acNewDoc = acDocColl.Add("acac.dwg");
            *  Document acNewDoc2 = acDocColl.Add("aca.dwg");*/

            /* foreach (Document acDoc in acDocColl)
             * {
             *
             *   acEd.WriteMessage($"\n{acDoc.Name}");
             *
             * }*/



            /*wind.WindowState = Window.State.Minimized;
             *
             * wind.Text = "学习学习再学习";
             * wind.SetLocation(new System.Drawing.Point(200, 200));
             * wind.SetSize(new System.Drawing.Size(500, 500));*/

            /*Application.ShowAlertDialog($"{acadApplication.Width},{acadApplication.Height}");*/


            /*foreach ( AcadPopupMenu pm in acadMenuBa)
             * {
             *
             *  acEd.WriteMessage($"\n{pm.Name}");
             *
             * }*/

            /*AcadPopupMenu pm = acadMenuBa.Item(0);
             *  pm.AddMenuItem(0, "画直线", "Line");*/

            acCtxMenuExten.Title = "自定义菜单";
            MenuItem acNewMenuItem = new MenuItem("创建新文档");

            acNewMenuItem.Click += (o, e) => {
                Document acNewDoc = acDocColl.Add("acac.dwg");
            };

            acCtxMenuExten.MenuItems.Add(acNewMenuItem);
            /*Application.AddDefaultContextMenuExtension(acCtxMenuExten);*/

            /*Application.AddObjectContextMenuExtension(RXObject.GetClass(typeof(Line)), acCtxMenuExten);*/
        }
Exemplo n.º 13
0
        internal static void Attach()
        {
            menuExtension_WT   = new ContextMenuExtension();
            menuExtension_WTLT = new ContextMenuExtension();
            LinemenuExtension  = new ContextMenuExtension();
            BlockmenuExtension = new ContextMenuExtension();

            //Default menu items
            menuExtension_WT.Title = "Wolvies Tools";
            acMenu item1 = new acMenu("Close All (Don't Save)");

            item1.Click += new EventHandler(item1_Click);
            menuExtension_WT.MenuItems.Add(item1);
            acMenu item2 = new acMenu("Close (Don't Save)");

            item2.Click += new EventHandler(item2_Click);
            menuExtension_WT.MenuItems.Add(item2);
            acMenu item3 = new acMenu("Running Distance");

            item3.Click += new EventHandler(item3_Click);
            menuExtension_WT.MenuItems.Add(item3);
            acMenu item4 = new acMenu("Join Text");

            item4.Click += new EventHandler(item4_Click);
            menuExtension_WT.MenuItems.Add(item4);
            acMenu item5 = new acMenu("Open current directory");

            item5.Click += new EventHandler(item5_Click);
            menuExtension_WT.MenuItems.Add(item5);

            menuExtension_WTLT.Title = "Layer tools";
            acMenu item6 = new acMenu("Grey out XREF");

            item6.Click += new EventHandler(item6_Click);
            menuExtension_WTLT.MenuItems.Add(item6);

            //Menu item for lines
            acMenu Line_item1 = new acMenu("Break line at point");

            Line_item1.Click += new EventHandler(Lineitem1_Click);
            LinemenuExtension.MenuItems.Add(Line_item1);

            //Menu item for blocks
            acMenu block_item1 = new acMenu("Open XREF (READ ONLY)");

            block_item1.Click += new EventHandler(Blockitem1_Click);
            BlockmenuExtension.MenuItems.Add(block_item1);

            //settting up RXClasses for entity tyles
            RXClass rxClass_Line = Entity.GetClass(typeof(Line));
            RXClass rxClass_xref = Entity.GetClass(typeof(BlockReference));

            //Adding in the menu extensions
            acApp.AddDefaultContextMenuExtension(menuExtension_WT);
            acApp.AddDefaultContextMenuExtension(menuExtension_WTLT);
            acApp.AddObjectContextMenuExtension(rxClass_Line, LinemenuExtension);
            acApp.AddObjectContextMenuExtension(rxClass_xref, BlockmenuExtension);
        }
 public static void Detach()
 {
     if (ContextMenu != null)
     {
         var rxcEnt = RXObject.GetClass(typeof(BlockReference));
         Application.RemoveObjectContextMenuExtension(rxcEnt, ContextMenu);
         ContextMenu = null;
     }
 }
Exemplo n.º 15
0
        public static void Start()
        {
            var cm   = new ContextMenuExtension();
            var menu = new MenuItem(Resources.ContextMenu);

            menu.Click += Click;
            cm.MenuItems.Add(menu);
            Application.AddObjectContextMenuExtension(RXObject.GetClass(typeof(Entity)), cm);
        }
Exemplo n.º 16
0
        public static void Attach()
        {
            cme        = new ContextMenuExtension();
            cme.Popup += cme_Popup;

            RXClass rxc = Entity.GetClass(typeof(Curve));

            Application.AddObjectContextMenuExtension(rxc, cme);
        }
Exemplo n.º 17
0
 public static void Attach()
 {
     cme = new ContextMenuExtension();
     MenuItem mi = new MenuItem("Count");
     mi.Click += new EventHandler(OnCount);
     cme.MenuItems.Add(mi);
     RXClass rxc = Entity.GetClass(typeof(Entity));
     Application.AddObjectContextMenuExtension(rxc, cme);
 }
Exemplo n.º 18
0
        public static void Attach()
        {
            cme = new ContextMenuExtension();
            MenuItem mi = new MenuItem("Count");

            mi.Click += new EventHandler(OnCount);
            cme.MenuItems.Add(mi);
            RXClass rxc = Entity.GetClass(typeof(Entity));

            Application.AddObjectContextMenuExtension(rxc, cme);
        }
Exemplo n.º 19
0
        public void test1()
        {
            ContextMenuExtension menuExt = new ContextMenuExtension();

            menuExt.Title = "psw_test";
            MenuItem item = new MenuItem("test");

            menuExt.MenuItems.Add(item);

            Application.AddDefaultContextMenuExtension(menuExt);
        }
Exemplo n.º 20
0
        void IExtensionApplication.Initialize( )
        {
            direct = Path.GetDirectoryName(Assembly.GetExecutingAssembly( ).Location);
            ContextMenuExtension come = new ContextMenuExtension( );

            come.Title = "小工具";
            // MenuItem mi=new MenuItem ( "自动图纸编号" );
            //  mi . Click += mi_Click; ;

            //  MenuItem mi1=new MenuItem ( "编号对照表" );
            //  mi1 . Click += mi1_Click;

            //   MenuItem mi2=new MenuItem ( "清除图框编号" );
            //   mi2 . Click += mi2_Click;

            MenuItem mi3 = new MenuItem("核对分区数量(CFQ)");

            mi3.Click += mi3_Click;

            // MenuItem mi4=new MenuItem ( "生产图纸" );
            // mi4 . Click += mi4_Click;

            MenuItem mi5 = new MenuItem("核对数量(CNU)");

            mi5.Click += mi5_Click;

            MenuItem mi7 = new MenuItem("检查文字重叠(CDB)");

            mi7.Click += Mi7_Click;

            //  MenuItem mi8 = new MenuItem("获取面积和周长");
            //  mi8.Click += Mi8_Click;

            MenuItem mi6 = new MenuItem("添加ST(ADDS)");

            mi6.Click += mi6_Click;

            MenuItem mi10 = new MenuItem("处理图纸(TUC)");

            mi10.Click += Mi10_Click;
            //  come . MenuItems . Add ( mi );
            //  come . MenuItems . Add ( mi1 );
            //  come . MenuItems . Add ( mi2 );
            come.MenuItems.Add(mi3);
            // come . MenuItems . Add ( mi4 );
            come.MenuItems.Add(mi5);
            come.MenuItems.Add(mi6);
            //   come.MenuItems.Add(mi8);
            come.MenuItems.Add(mi7);

            come.MenuItems.Add(mi10);

            Autodesk.AutoCAD.ApplicationServices.Application.AddDefaultContextMenuExtension(come);
        }
Exemplo n.º 21
0
        private void AddContextMenu()
        {
            m_ContextMenu = new ContextMenuExtension();
            m_ContextMenu.Title = "Acme Employee Menu";
            Autodesk.AutoCAD.Windows.MenuItem mi;
            mi = new Autodesk.AutoCAD.Windows.MenuItem("Create Employee");
            mi.Click += new EventHandler(CallbackOnClick);
            m_ContextMenu.MenuItems.Add(mi);

            Autodesk.AutoCAD.ApplicationServices.Application.AddDefaultContextMenuExtension(m_ContextMenu);
        }
Exemplo n.º 22
0
        public static void AttachContextMenu()
        {
            var cme  = new ContextMenuExtension();
            var menu = new MenuItem(MenuName);

            menu.Click += (o, e) => SelectBlockByParameters();
            //menu.Icon = PIK_Acad_Common.Properties.Resources.select;
            cme.MenuItems.Add(menu);
            //cme.MenuItems.Add(new MenuItem(""));
            cme.Popup += Cme_Popup;
            Application.AddObjectContextMenuExtension(RxClassBlockRef, cme);
        }
Exemplo n.º 23
0
        public void AddCustomMenu()
        {
            //定义一个ContextMenuExtension对象,用于表示快捷菜单
            var ctxMenu = new ContextMenuExtension();

            ctxMenu.Title = "自定义菜单";
            var mi = new MenuItem("图纸比对");

            mi.Click += new EventHandler(mi_Click);
            ctxMenu.MenuItems.Add(mi);
            Application.AddDefaultContextMenuExtension(ctxMenu);
        }
Exemplo n.º 24
0
        /// <summary>添加右键菜单项
        ///
        /// </summary>
        private void AddContextMenu()
        {
            m_ContextMenu       = new ContextMenuExtension();
            m_ContextMenu.Title = "PSW自定义菜单";
            Autodesk.AutoCAD.Windows.MenuItem mi;
            mi        = new Autodesk.AutoCAD.Windows.MenuItem("创建圆");
            mi.Click += MyMenuItem_OnClick;

            m_ContextMenu.MenuItems.Add(mi);

            Application.AddDefaultContextMenuExtension(m_ContextMenu);
        }
Exemplo n.º 25
0
        /// <summary>
        /// 添加右键菜单项
        /// </summary>
        private void AddContextMenu()
        {
            m_ContextMenu       = new ContextMenuExtension();
            m_ContextMenu.Title = "玻璃幕墙分析";

            Autodesk.AutoCAD.Windows.MenuItem mi;
            mi = new Autodesk.AutoCAD.Windows.MenuItem("玻璃幕墙分析");
            //关联菜单项的处理函数
            mi.Click += MyMenuItem_OnClick;
            m_ContextMenu.MenuItems.Add(mi);

            Application.AddDefaultContextMenuExtension(m_ContextMenu);
        }
Exemplo n.º 26
0
        /// <summary>
        /// 新建添加一个右键菜单项
        /// </summary>
        private void AddContextMenu()
        {
            m_pContextMenu       = new ContextMenuExtension();
            m_pContextMenu.Title = "导出";

            Autodesk.AutoCAD.Windows.MenuItem pMenuItem;
            pMenuItem = new Autodesk.AutoCAD.Windows.MenuItem("导出到Excel");

            // 关联菜单的时间处理函数
            pMenuItem.Click += CxExportMenu_OnClick;
            m_pContextMenu.MenuItems.Add(pMenuItem);
            Application.AddDefaultContextMenuExtension(m_pContextMenu);
        }
            public static void Attach()
            {
                if (ContextMenu == null)
                {
                    // For Entity
                    ContextMenu = new ContextMenuExtension();
                    var miEnt = new MenuItem(Language.GetItem(LangItem, "h59"));
                    miEnt.Click += StartFunction;
                    ContextMenu.MenuItems.Add(miEnt);

                    var rxcEnt = RXObject.GetClass(typeof(BlockReference));
                    Application.AddObjectContextMenuExtension(rxcEnt, ContextMenu);
                }
            }
Exemplo n.º 28
0
        public static void AttachContextMenu()
        {
            // Стандартное описание процесса добавления строки меню, не понятно где ты объявил метод Detach? Можешь тут ответить, имею ввиду почему в сокращенном виде - просто Deatch?
            // Поглядел дальше - там и объявлен? Бля...у меня из-за этого вынос мозга))) Указали что делать по щелчку, не объяснив заранее как это делать...Типа сделай это, но я потом расскажу как) Или это компилятор потом в порядок приводит? Который JIT, сегодня новое слово узнал)))
            var cme = new ContextMenuExtension();

            Menu        = new MenuItem(MenuName);
            Menu.Click += (o, e) => Detach();
            cme.MenuItems.Add(Menu);
            cme.MenuItems.Add(new MenuItem(""));
            // пока не имеет смысла, нужно научиться проверять принадлежность хар.линии к поверхности, без перебора всех поверхностей, только по самой линии
            //cme.Popup += Cme_Popup;
            Application.AddObjectContextMenuExtension(RxClassFeatureLine, cme);
        }
Exemplo n.º 29
0
        // 3. Create a private void procedure named AddContextMenu.
        // Note: Put the Closing Curley brace after step 12.
        private void AddContextMenu()
        {
            // 4. Declare an editor variable. Instantiate it by making it equal to the
            // Editor property of the Application.DocumentManager.MdiActiveDocument.Editor
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

            // 5. Add a try catch block.
            // Note: put the closing curley brace for the try below step 11.
            // Put the catch below this. The curley brace for the catch is
            // after step 12.
            try
            {
                // 6. Make the ContextMenuExtension declared in step 2 equal
                // to a new ContextMenuExtension
                myContextMenu = new ContextMenuExtension();

                // 7. Make the Title property of the ContextMenuExtension
                // instantiated in step 7 equal to "Circle Jig". (it is going
                // to run the command completed in Lab3).
                myContextMenu.Title = "Circle Jig";

                // 8. Declare a MenuItem variable named mi. Instantiate by
                // making it eaual to a new MenuItem. For the string parameter
                // use a string like "Run Circle Jig".
                MenuItem mi = new MenuItem("Run Circle Jig");

                // 9. The way the Context menu works is that for each menu entry, we specify a
                // specific member function to be called handling the menu click event.
                // Use the MenuItem Click event (mi.Click += )to specify that we want the
                // click event to be handled by a function named CallbackOnClick. You will
                // create this function in step 20 - 22.
                mi.Click += CallbackOnClick;

                // 10. Use the Add method of the MenuItems collection of the
                // ContextMenuExtension instantiated in step 6. Pass in the
                // MenuItem created in step 8.
                myContextMenu.MenuItems.Add(mi);

                // 11. Use the AddDefaultContextMenuExtension of the Application.
                // Pass in the ContextMenuExtension
                Autodesk.AutoCAD.ApplicationServices.Application.AddDefaultContextMenuExtension(myContextMenu);
            }
            catch (Exception ex)
            {
                // 12. Use the editor variable created in step 4 and write a message.
                // to the command line Something like"
                // "Error Adding Context Menu: " + ex.Message
                ed.WriteMessage("Error Adding Context Menu: " + ex.Message);
            }
        }
Exemplo n.º 30
0
 private void RemoveContextMenu()
 {
     try
     {
         if (_menu != null)
         {
             Application.RemoveDefaultContextMenuExtension(_menu);
             _menu = null;
         }
     }
     catch
     {
     }
 }
Exemplo n.º 31
0
        private void AddContextMenu()
        {
            //ContextMenuExtension m_ContextMenu;//����Ϊ��ij�Ա����
            m_ContextMenu = new ContextMenuExtension();
            m_ContextMenu.Title = "�ҵ��Զ���˵�";
            Autodesk.AutoCAD.Windows.MenuItem mi;
            mi = new Autodesk.AutoCAD.Windows.MenuItem("����Բ");
            mi.Click += MyMenuItem_OnClick;
            m_ContextMenu.MenuItems.Add(mi);

            Autodesk.AutoCAD.ApplicationServices.Application.AddDefaultContextMenuExtension(m_ContextMenu);
            //��Ӷ��󼶱���Ҽ��˵�(˵�������������䲻ͬ��
            //Autodesk.AutoCAD.ApplicationServices.Application.AddObjectContextMenuExtension(Circle.GetClass(typeof(Circle)), m_ContextMenu);
        }
Exemplo n.º 32
0
        public static void Attach()
        {
            if (MpPrToTableCme == null)
            {
                MpPrToTableCme = new ContextMenuExtension();
                var miEnt = new MenuItem(Language.GetItem(LangItem, "h8"));
                miEnt.Click += SendCommand;
                MpPrToTableCme.MenuItems.Add(miEnt);
            }

            var rxcEnt = RXObject.GetClass(typeof(Entity));

            Application.AddObjectContextMenuExtension(rxcEnt, MpPrToTableCme);
        }
Exemplo n.º 33
0
        public void AddContextMenu()
        {
            ContextMenuExtension ce = new ContextMenuExtension();

            ce.Title = "台账管理";
            MenuItem mi1 = new MenuItem("属性修改");

            mi1.Click += new EventHandler(mi1_Click);
            MenuItem mi2 = new MenuItem("批量修改");

            mi2.Click += new EventHandler(mi2_Click);
            ce.MenuItems.Add(mi1);
            ce.MenuItems.Add(mi2);
            Autodesk.AutoCAD.ApplicationServices.Application.AddDefaultContextMenuExtension(ce);
        }
Exemplo n.º 34
0
        private static void AttachCreateAnalogContextMenu()
        {
            if (_intellectualEntityContextMenu == null)
            {
                _intellectualEntityContextMenu = new ContextMenuExtension();
                var menuItem = new Autodesk.AutoCAD.Windows.MenuItem(Language.GetItem("h95"));
                menuItem.Click += CreateAnalogMenuItem_Click;
                _intellectualEntityContextMenu.MenuItems.Add(menuItem);
            }

            var rxObject = RXObject.GetClass(typeof(BlockReference));

            Autodesk.AutoCAD.ApplicationServices.Application.AddObjectContextMenuExtension(
                rxObject, _intellectualEntityContextMenu);
        }
Exemplo n.º 35
0
        public static void AddMe()
        {
            try
            {
                s_cme = new ContextMenuExtension();
                s_cme.Title = "Watcher";

                MenuItem mi = new MenuItem("Events Watcher ...");
                mi.Click += new EventHandler(callback_OnClick);
                s_cme.MenuItems.Add(mi);

                MenuItem mi1 = new MenuItem("Events Ouput Window");
                mi1.Click += new EventHandler(callback_OnClick1);
                s_cme.MenuItems.Add(mi1);

                Application.AddDefaultContextMenuExtension(s_cme);
            }
            catch (System.Exception ex)
            {
                Helper.Message(ex);
            }
        }
Exemplo n.º 36
0
        private void AddContextMenu()
        {
            m_ContextMenu = new ContextMenuExtension();
            m_ContextMenu.Title = "Acme Employee Menu";
            Autodesk.AutoCAD.Windows.MenuItem mi;
            mi = new Autodesk.AutoCAD.Windows.MenuItem("Create Employee");
            mi.Click += new EventHandler(CallbackOnClick);
            m_ContextMenu.MenuItems.Add(mi);

            Autodesk.AutoCAD.ApplicationServices.Application.AddDefaultContextMenuExtension(m_ContextMenu);
        }
Exemplo n.º 37
0
        internal static void Attach()
        {
            menuExtension_WT = new ContextMenuExtension();
            menuExtension_WTLT = new ContextMenuExtension();
            LinemenuExtension = new ContextMenuExtension();
            BlockmenuExtension = new ContextMenuExtension();

            //Default menu items
            menuExtension_WT.Title = "Wolvies Tools";
            acMenu item1 = new acMenu("Close All (Don't Save)");
            item1.Click += new EventHandler(item1_Click);
            menuExtension_WT.MenuItems.Add(item1);
            acMenu item2 = new acMenu("Close (Don't Save)");
            item2.Click += new EventHandler(item2_Click);
            menuExtension_WT.MenuItems.Add(item2);
            acMenu item3 = new acMenu("Running Distance");
            item3.Click += new EventHandler(item3_Click);
            menuExtension_WT.MenuItems.Add(item3);
            acMenu item4 = new acMenu("Join Text");
            item4.Click += new EventHandler(item4_Click);
            menuExtension_WT.MenuItems.Add(item4);
            acMenu item5 = new acMenu("Open current directory");
            item5.Click += new EventHandler(item5_Click);
            menuExtension_WT.MenuItems.Add(item5);

            menuExtension_WTLT.Title = "Layer tools";
            acMenu item6 = new acMenu("Grey out XREF");
            item6.Click += new EventHandler(item6_Click);
            menuExtension_WTLT.MenuItems.Add(item6);

            //Menu item for lines
            acMenu Line_item1 = new acMenu("Break line at point");
            Line_item1.Click += new EventHandler(Lineitem1_Click);
            LinemenuExtension.MenuItems.Add(Line_item1);

            //Menu item for blocks
            acMenu block_item1 = new acMenu("Open XREF (READ ONLY)");
            block_item1.Click += new EventHandler(Blockitem1_Click);
            BlockmenuExtension.MenuItems.Add(block_item1);

            //settting up RXClasses for entity tyles
            RXClass rxClass_Line = Entity.GetClass(typeof(Line));
            RXClass rxClass_xref = Entity.GetClass(typeof(BlockReference));

            //Adding in the menu extensions
            acApp.AddDefaultContextMenuExtension(menuExtension_WT);
            acApp.AddDefaultContextMenuExtension(menuExtension_WTLT);
            acApp.AddObjectContextMenuExtension(rxClass_Line, LinemenuExtension);
            acApp.AddObjectContextMenuExtension(rxClass_xref, BlockmenuExtension);
        }