• 双击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;

                    }

                }

            }

        }

  • 相关阅读:
    关于BFS
    关于bitset
    关于线段树(数组和指针两种实现方法)
    关于RMQ问题
    浅谈树状数组
    洛谷—— P3865 【模板】ST表
    洛谷—— P3807 【模板】卢卡斯定理
    2017-10-29-afternoon-清北模拟赛
    2017-10-29-morning-清北模拟赛
    51Nod 1526 分配 笔名
  • 原文地址:https://www.cnblogs.com/cadlife/p/3463337.html
Copyright © 2020-2023  润新知