Пример #1
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);
        }
Пример #2
0
        public static void Attach()
        {
            conMenuExt = new acw.ContextMenuExtension();
            acw.MenuItem mi = new acw.MenuItem("Total Length");
            mi.Click += new EventHandler(OnTotalLength);
            conMenuExt.MenuItems.Add(mi);
            RXClass rxc = Entity.GetClass(typeof(Entity));

            AcAp.AddObjectContextMenuExtension(rxc, conMenuExt);
        }
Пример #3
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);
        }
Пример #4
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);
        }
Пример #5
0
 private static void Lineitem1_Click(object sender, EventArgs e)
 {
     Autodesk.AutoCAD.Windows.MenuItem mItem = sender as Autodesk.AutoCAD.Windows.MenuItem;
     if (mItem != null)
     {
         if (mItem.Text == "Break line at point")
         {
             Document doc = acApp.DocumentManager.MdiActiveDocument;
             doc.SendStringToExecute("breakatpoint ", false, false, true);
         }
     }
 }
Пример #6
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);
        }
Пример #7
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);
        }
Пример #8
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);
        }
Пример #9
0
        public static void Attach()
        {
            mDigitalMenu = new AdeskWin.ContextMenuExtension();
            mDigitalMenu.Title = "YCRO";

            AdeskWin.MenuItem digital_mi = new AdeskWin.MenuItem("����ǩ��");
            digital_mi.Click += new EventHandler(ShowDigital);
            AdeskWin.MenuItem frame_mi = new AdeskWin.MenuItem("����ͼ��");
            frame_mi.Click += new EventHandler(ShowFrame);
            mDigitalMenu.MenuItems.Add(digital_mi);
            mDigitalMenu.MenuItems.Add(frame_mi);

            AdeskAppSvr.Application.AddDefaultContextMenuExtension(mDigitalMenu);
        }
        public static void Attach()
        {
            mDigitalMenu       = new AdeskWin.ContextMenuExtension();
            mDigitalMenu.Title = "YCRO";

            AdeskWin.MenuItem digital_mi = new AdeskWin.MenuItem("电子签名");
            digital_mi.Click += new EventHandler(ShowDigital);
            AdeskWin.MenuItem frame_mi = new AdeskWin.MenuItem("电子图框");
            frame_mi.Click += new EventHandler(ShowFrame);
            mDigitalMenu.MenuItems.Add(digital_mi);
            mDigitalMenu.MenuItems.Add(frame_mi);

            AdeskAppSvr.Application.AddDefaultContextMenuExtension(mDigitalMenu);
        }
Пример #11
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);
            }
        }
Пример #12
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);
        }
Пример #13
0
        public void AddContextMenu()
        {
            ContextMenuExtension ce = new ContextMenuExtension();

            ce.Title = "快捷菜单";
            Autodesk.AutoCAD.Windows.MenuItem mi1 = new Autodesk.AutoCAD.Windows.MenuItem("创建线");
            mi1.Click += new EventHandler(mi1_Click);

            Autodesk.AutoCAD.Windows.MenuItem mi2 = new Autodesk.AutoCAD.Windows.MenuItem("创建圆");
            mi2.Click += new EventHandler(mi2_Click);

            ce.MenuItems.Add(mi1);
            ce.MenuItems.Add(mi2);
            Autodesk.AutoCAD.ApplicationServices.Application.AddDefaultContextMenuExtension(ce);
        }
Пример #14
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);
        }
Пример #15
0
            public static void Attach()
            {
                ConMenExt = new ContextMenuExtension {
                    Title = "AcadIO"
                };
                MenuItem menuSelect = new MenuItem("Select");

                menuSelect.Click += new EventHandler(MenuSelectClick);
                string filename = World.InstallPath + "\\_DemoObjects\\" + "select.ico";
                Icon   ic       = new Icon(filename);

                menuSelect.Icon    = ic;
                menuSelect.Checked = false;
                ConMenExt.MenuItems.Add(menuSelect);
                Application.AddDefaultContextMenuExtension(ConMenExt);

                ConMenExt.Title = "Launch Dock";
                Autodesk.AutoCAD.Windows.MenuItem menuLaunchDock = new Autodesk.AutoCAD.Windows.MenuItem("Launch Dock");
                menuLaunchDock.Click += new EventHandler(MenuLaunchDock);
                filename              = World.InstallPath + "\\_DemoObjects\\" + "dock.ico";
                ic = new Icon(filename);
                menuLaunchDock.Icon = ic;
                ConMenExt.MenuItems.Add(menuLaunchDock);
            }
Пример #16
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);
        }
Пример #17
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);
        }