AutoCAD.net: DoubleClick

 

Double clicking on most objects in the drawing window displays the Properties palette. This behavior can be changed with the DoubleClickAction and DoubleClickCmd classes. Use this to add behavior to custom objects as well.

To edit the double-click behavior, first attach a MacroId to a DoubleClickCmd object. This defines the action that will be performed. Next, attach a DoubleClickAction to a drawing object using the DxfName() property. Finally attach the action to the command.

 

            string acadCui = (string)Application.GetSystemVariable("MENUNAME") + ".cui"; //Get mainCuiFile

            acadCui = acadCui.ToLower();

            CustomizationSection cs0 = new CustomizationSection(acadCui);

            string customCui = acadCui.Replace("acad.cui", "custom.cui"); //Get partialCui

            CustomizationSection custom = new CustomizationSection(customCui);

 

            DoubleClickAction dblClickAction = new DoubleClickAction(custom.MenuGroup, "My Double click", -1);

            dblClickAction.DxfName = "Polyline";

            DoubleClickCmd dblClickCmd = new DoubleClickCmd(dblClickAction);

            dblClickCmd.MacroID = "MM_1567";

            dblClickAction.DoubleClickCmd = dblClickCmd;

 

            /*dblClickAction is now set to execute the polyline edit macro (MM_1567) when a Polyline is double-clicked.

             * If a double-click action for an object is overridden, the new action takes precedence,

             * and the old action becomes inactive.

             */

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值