切换文档
涉及多文档必须为其CommandMethod属性添加CommandFlags.Session标识,但是现在我设计了一个窗体,其中添加一个按钮,当单击按钮时要执行多文档,要如何解决?private void button4_Click(object sender, EventArgs e)
{
this.Dispose();关闭窗体
Document doc = AcadApp.DocumentManager.MdiActiveDocument;
Editor ed = AcadApp.DocumentManager.MdiActiveDocument.Editor;
Database curDb = doc.Database;
using (doc.LockDocument())//
{
using (Database db = curDb.Wblock(ids, pt))
{
db.SaveAs(filename,DwgVersion.AC1015);
Document savedoc = AcadApp.DocumentManager.Open(filename, false);
AcadApp.DocumentManager.MdiActiveDocument = savedoc;//此处会出错
savedoc.SendStringToExecute("qsave ", false, false, false);
}
}
}
页:
[1]