zoukankan      html  css  js  c++  java
  • 双击CAD对象,显示自定义对话框实现方法

        class TlsApplication : IExtensionApplication

        {

            void IExtensionApplication.Initialize()

            {

                TTest.Start();

            }

            void IExtensionApplication.Terminate()

            {

            }

        }

        class TTest

        {

            static bool m_Veto = false;

            public static void Start()

            {

                Application.DocumentManager.DocumentLockModeChanged += new DocumentLockModeChangedEventHandler(vetoCommand);

                Application.BeginDoubleClick += new BeginDoubleClickEventHandler(beginDoubleClick);

            }

            static void beginDoubleClick(object sender, BeginDoubleClickEventArgs e)

            {

                Document doc = Application.DocumentManager.MdiActiveDocument;

                Editor ed = doc.Editor;

                PromptSelectionResult res = ed.SelectImplied();

                SelectionSet ss = res.Value;

                if (ss != null)

                {

                    if (ss.Count == 1)

                    {

                        using (Transaction tr = doc.TransactionManager.StartTransaction())

                        {

                            Line line = tr.GetObject(ss[0].ObjectId, OpenMode.ForRead) as Line;

                            if (line != null)

                            {

                                ResultBuffer rb = line.GetXDataForApplication("MyApp");

                                if (rb != null)

                                {

                                    m_Veto = true;

                                }

                            }

                        }

                    }

                }

            }

            static void vetoCommand(object sender, DocumentLockModeChangedEventArgs e)

            {

                if (e.GlobalCommandName.ToLower() == "properties")

                {

                    if (m_Veto)

                    {

                        e.Veto();

                       

                        Application.ShowAlertDialog("hello");

                        m_Veto = false;

                    }

                }

            }

        }

  • 相关阅读:
    SourceTree 3.0.17如何跳过注册进行安装? — git图形化工具(一)
    一键复制功能
    如何适配处理iphoneX底部的横条
    .gitignore文件如何编写?
    Spring事务管理——事务的传播行为
    数据库事务之声明式事务
    JVM中的内存分区简介
    SpringMVC中文件的上传(上传到服务器)和下载问题(二)--------下载
    SpringMVC中文件的上传(上传到服务器)和下载问题(一)--------上传
    HashMap和Hashtable的区别
  • 原文地址:https://www.cnblogs.com/cadlife/p/3463337.html
Copyright © 2011-2022 走看看