zoukankan      html  css  js  c++  java
  • 【AutoCAD.NET】程序的初始化和终止化清理工作

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Autodesk.AutoCAD.ApplicationServices;
    using Autodesk.AutoCAD.Runtime;
    using Autodesk.AutoCAD.EditorInput;
    
    namespace InitAndOpt
    {
        public class InitClass : IExtensionApplication
        {
            //程序的初始化
            public void Initialize()
            {
                Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
                //在AutoCAD命令行载入信息,它们会在程序载入时显示
                ed.WriteMessage("程序开始初始化");
            }
    
            //程序的终止化清理工作
            public void Terminate()
            {
                System.Diagnostics.Debug.WriteLine("程序结束,你可以做一些清理工作");
            }
    
            //注册一个命令
            [CommandMethod ("InitCommand")]
            public void InitCommand()
            {
                Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
                ed.WriteMessage("测试初始化...");
            }
    
        }
    }

    同样的,需要设置用frame work 3.5编译以及引用两个程序集且要添加三个命名空间

    <<<<<<end>>>>>>

  • 相关阅读:
    面向对象-类
    模块04
    总结
    昨天的新的解决方法
    感冒了~ vs中py和vb实现一个小算法
    vs2015社区版不支持installshield
    网站被黑了
    2018/11/18(python)
    2018/11/14
    2018/11/12(python)
  • 原文地址:https://www.cnblogs.com/Helchan/p/4395684.html
Copyright © 2011-2022 走看看