ObjectARX 模态对话框中夹点显示选中的对象示例
添加对话框,修改调用对话框的命令参数
命令参数需要添加 ACRX_CMD_USEPICKSET | ACRX_CMD_REDRAW
ACED_ARXCOMMAND_ENTRY_AUTO(CArxProject1App, ArxProject1, mydlg, mydlg, ACRX_CMD_TRANSPARENT | ACRX_CMD_USEPICKSET | ACRX_CMD_REDRAW, NULL)
添加夹点亮显
主要使用acedSSSetFirst设置亮显, acedUpdateDisplay更新显示。
void CMydlg::OnBnClickedButton1()
{
// TODO: 在此添加控件通知处理程序代码
BeginEditorCommand();
ads_name ss;
if(RTNORM == acedSSGet(_T("L"),NULL,NULL,NULL,ss))
{
acedSSSetFirst(ss,NULL);
acedUpdateDisplay(); //更新显示
acedSSFree(ss);
}
CompleteEditorCommand();
}
.net例子
net添加命令
namespace ClassLibrary1
{
public class Class1
{
[CommandMethod("mydlg",CommandFlags.UsePickSet|CommandFlags.Redraw|CommandFlags.Transparent)]
public void ShowModalDialog()
{
using (Form1 form = new Form1())
{
Application.ShowModalDialog(form);
}
}
}
}
按钮消息
private void button1_Click(object sender, EventArgs e)
{
Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
using (EditorUserInteraction edUsrInt = ed.StartUserInteraction(this))
{
var res = ed.SelectLast();
if(res.Status == PromptStatus.OK)
{
ed.SetImpliedSelection(res.Value);
ed.UpdateScreen();
}
edUsrInt.End();
this.Focus();
}
}