马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×

- using Autodesk.AutoCAD.ApplicationServices;
- using Autodesk.AutoCAD.Runtime;
- [assembly: ExtensionApplication(typeof(ClassLibrary2.Class1))]
- [assembly: CommandClass(typeof(ClassLibrary2.MyCommands))]
- namespace ClassLibrary2
- {
- public class Class1 : IExtensionApplication
- {
- public void Initialize()
- {
- var mc = new MyCommands();
- mc.MyCommandEvents();
- }
- public void Terminate()
- {
- }
- }
- public class MyCommands
- {
- private string _cmdname = "";
- internal void MyCommandEvents()
- {
- Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument.CommandEnded +=
- MdiActiveDocument_CommandEnded;
- }
- private void MdiActiveDocument_CommandEnded(object sender, CommandEventArgs e)
- {
- _cmdname = e.GlobalCommandName;
- Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(
- "\n{0} ended.",
- e.GlobalCommandName);
- }
- }
- }
|