0
我已经写了AutoCAD中的C#插件,用户可以输入一些信息,之后相应的图纸应双头呆了。C#更改Windows形成以ontop的打开AutoCAD绘图
实际的工作流程应该是:
- 我开始我的插件在AutoCAD
- 用户可以输入在Windows窗体中的一些信息是当前活动绘图
- 当用户的顶部点击输入按钮应该打开一个新的图纸
- 用户输入一些信息的表格应该关闭(工作正常)
- 应该打开一个新的窗口窗体来输入一些其他信息(与第一个窗口不一样)但在新图纸中
问题是我可以正确关闭第一个窗口并打开新图形。就像这样:
DocumentCollection documentCollection = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager;
if (File.Exists(absoultePathOfDrawing))
{
Document newDrawing = documentCollection.Open(absoultePathOfDrawing, false);
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument = newDrawing; // this sets the new drawing as the active one ==> is on top
}
Dispose(); // closes the first form
DialogResult = DialogResult.OK; // tells my applciation that the first window was successfully closed
形式正确关闭,后来我尝试与打开新的形式:
if (result == DialogResult.OK)
{
MessageBox.Show("Test");
}
但现在的新的绘画是在上面,背后是老图。当我切换回旧图形时,将显示新的MessageBox,但实际上这应该显示在新图形中,因为我将活动文档设置为新图形。 我在做什么错?