zoukankan      html  css  js  c++  java
  • 使用C#语言,如何实现EPLAN二次开发 Api插件及菜单展示

    上期我们谈谈了谈EPLAN电气制图二次开发,制图软件EPLAN的安装和破解,今天我们来说说使用C#语言,如何实现Api插件及菜单,今天它来了!!!

    关于项目环境的搭建请参考:https://blog.csdn.net/Laity07/article/details/109215518

    下面我们一起来看看

    我们就以我写的一个例子来看

    首先建立一个这样的类,

    using Eplan.EplApi.ApplicationFramework;
    using Eplan.EplApi.DataModel;
    using Eplan.EplApi.HEServices;
    using Frm_Eplan_EplanApi;
    using Frm_Eplan_EplanApi.ViewModel;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows;
    using System.Windows.Forms;
    
    namespace Eplan_EplanApi
    {
        public class MyAction : IEplAction, IEplActionEnable
        {
            //public delegate //PathFileAcross pathFile;
            public bool Execute(ActionCallingContext ctx)
            {
                
                return true;
    
            }
    
            public bool OnRegister(ref string Name, ref int Ordinal)
            {
                Name = "功能配置";
                Ordinal = 20;
                return true;
            }
    
            public void GetActionProperties(ref ActionProperties actionProperties)
            {
                // actionProperties.Description = "Action test with parameters."; 
            }
    
            public bool Enabled(string strActionName, ActionCallingContext actionContext)
            { 
                return true;
            }
        }
    }
    MyAction

    第二步,我们再建一个这样的类

    using Eplan.EplApi.Base;
    using Eplan.EplApi.Gui;
    using System;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Linq;
    using System.Reflection;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using ContextMenu = System.Windows.Forms.ContextMenu;
    
    namespace Eplan_EplanApi
    {
        public class AddInModule : Eplan.EplApi.ApplicationFramework.IEplAddIn
        {
            public bool OnExit()
            {
                return true;
            }
            public bool OnInit()
            {
                return true;
            }
    
            public bool OnInitGui()
            {
                //菜单栏菜单
                Eplan.EplApi.Gui.Menu oMenu = new Eplan.EplApi.Gui.Menu();
              //一级菜单
                uint num1 = oMenu.AddMainMenu("Test", Eplan.EplApi.Gui.Menu.MainMenuName.eMainMenuHelp, "项目配置", "MyAction", "项目配置", 0);
                
                
                #region 单功能配置显示二级菜单
                  //我们在一级菜单的基础上新增新的菜单,并在二级菜单显示新的子菜单
               //此处的“功能配置”为二级菜单名称
                uint menu3 = oMenu.AddPopupMenuItem("功能配置", "此处都为你二级菜单下子菜单的Action类(例如:电源进线)", "电源进线", "电源进线", num1, 1, false, false);
                oMenu.AddMenuItem("控制电源", "此处都为你二级菜单下子菜单的Action类(例如:控制电源)", "控制电源", menu3, 1, true, false); 
                #endregion 
                return true;
            }
    
            public bool OnRegister(ref bool bLoadOnStart)
            {
                bLoadOnStart = true;
                return true;
            }
    
            public bool OnUnregister()
            {
                return true;
            }
        }
    }
    AddInModule

    最后一定要把  右击-打开项目属性的程序集名称修改为这样的格式 EPLAN.EplAddin.MyAddIn

    这些都设置好了,我们下面看看将生成的.dll的程序集加载到EPLAN中后的效果吧

    最后这个东西吧,还是要好好阅读API文档,看懂了就明白了。

    https://blog.csdn.net/Laity07/article/details/109236645

    Nothing that has meaning is easy.
    凡是有意义的事都不简单。

  • 相关阅读:
    php图片上传代码
    数据库笔记
    数学函数类方法的使用.java
    有n人围成一圈,顺序排号。从第1个人开始报数(从1到3报数),凡报到3的人退出圈子,问最后留下的是原来的第几号的那位。
    现有有N个学生的数据记录,每个记录包括学号、姓名、三科成绩。 编写一个函数input,用来输入一个学生的数据记录。 编写一个函数print,打印一个学生的数据记录。 在主函数调用这两个函数,读取N条记录输入,再按要求输出。 N<100
    求Sn=1!+2!+3!+4!+5!+…+n!之值,其中n是一个数字
    分数相加减的代码(c++)
    Caesar cipher
    db2、Oracle存储过程引号用法
    CSS基础总结
  • 原文地址:https://www.cnblogs.com/wj1107/p/13955961.html
Copyright © 2011-2022 走看看