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;

                    }

                }

            }

        }

  • 相关阅读:
    BZOJ4240: 有趣的家庭菜园
    BZOJ1509: [NOI2003]逃学的小孩
    BZOJ5301: [Cqoi2018]异或序列
    BZOJ4540: [Hnoi2016]序列
    BZOJ4956: [Wf2017]Secret Chamber at Mount Rushmore
    BZOJ2141: 排队
    BZOJ1833: [ZJOI2010]count 数字计数
    HDU2089: 不要62
    BZOJ5178: [Jsoi2011]棒棒糖
    BZOJ3439: Kpm的MC密码
  • 原文地址:https://www.cnblogs.com/cadlife/p/3463337.html
Copyright © 2011-2022 走看看