C#插件开发指南:从创建到实现.pdfVIP

  • 0
  • 0
  • 约9.69千字
  • 约 12页
  • 2026-01-16 发布于北京
  • 举报

3、将类名更改为所需的类名。并在类文件顶部添加命名空间usingSysPluginLibrary;如果需

要使用windows.forms功能,则需程序员自行添加System.Windows.Forms及命名空间。

4、将新建类继承BaseTool/ITool或者BaseCommand/ICommand或者IPlugin,单

击实现抽象类或接口。单击后,VS会自动实现抽象类或接口。

初始化

通过构造函数进行插件的初始化

namespaceMapCommand{publicclass

CapConvertAlgo:BaseCommand{public

CapConvertAlgo(){}}}

不同类型(接口)的实现

usingSystem;usingSystem.Collections.Generic;using

System.Windows.Forms;using

SysPluginLibrary.Command;namespace

MapCommand{publicclassCapConvertAlgo:

BaseCommand{publicCapConvertAlgo(){}publicoverride

voidOnClick(){FrmCapConvertfrm==new

FrmCapConvert();frm.ShowDialog();}}}

3、更改类名为自己想要的类名。并在类文件顶部添加命名空间usingSysPluginLibrary;

如需使用windows.forms功能则需程序员自行添加System.Windows.Forms及命名空间。

4、将新建类继承BaseTool/ITool或者BaseCommand/ICommand或者IPlugin,单击右键点

击实现抽象类或接口。单击后,VS会自动实现抽象类或接口。

初始化

通过构造函数进行插件的初始化

namespaceMapCommand

{

publicclassCapConvertAlgo:BaseCommand

{

publicCapConvertAlgo()

{

}

}

}

不同类型(接口)的实现

usingSystem;

usingSystem.Collections.Generic;

usingSystem.Windows.Forms;

usingSysPluginLibrary.Command;

namespaceMapCommand

{

publicclassCapConvertAlgo:BaseCommand

{

publicCapConvertAlgo()

{

}

publicoverridevoidOnClick()

{

FrmCapConvertfrm=newFrmCapConvert();

frm.ShowDialog();

}

}

}

usingSystem;usingSystem.Drawing;usingSystem.Windows.Forms;usingSysPluginLibrary;using

SysPluginLibrary.Command;usingSysPluginComLib;namespaceMapCommand{publicclass

ZoomInTool:BaseTool{privatePointstartPoint=newPoint(0,0);//鼠标初始的坐标

privatePointendPoint=newPoint(0,0);//鼠标释放的坐标//privateBitmap_fScreen;//绘

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档