我为AutoCAD创建了一个基本插件。在我的插件中,有一些任务是通过c# windows表单完成的。当窗口窗体打开时,我的最终用户需要访问autocad。当前,如果打开了AutoCAD windows窗体,则无法访问c#。要使用AutoCAD,用户必须先关闭表单。
是否有办法使autocad和windows窗体同时可访问?
发布于 2015-09-02 16:38:42
是的,您可以使用非模式表单:
Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog但这并不是很直观,我建议使用一个承载用户控件的PaletteSet。
Autodesk.AutoCAD.Windows.PaletteSet ps; // declare as a STATIC variable, avoid duplicate
ps.Add("Name here", userCtrl);
ps.Visible = true;我更喜欢使用Modal方式,在需要用户选择绘图内容的按钮中,使用EditorUserInteraction对象
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
using (EditorUserInteraction userIt = ed.StartUserInteraction())
{
// this will close the form and go to the model space, once finished, the form gets back
}https://stackoverflow.com/questions/32357924
复制相似问题