不打开文件操作db时,如果遇到和窗体交互,不会提示文档未锁,但同样需要锁定当前文档,代码如下

代码
                   //隐藏打开图形数据库db
                    db = CAD.CADMgr.CADEntity.Getdb(
                          ConfigInfo.productPath 
+ file.Path,
                          System.IO.FileShare.ReadWrite, 
false);
                    
if (Application.DocumentManager.Count == 0)
                    {
                        Application.DocumentManager.Add(
"acadiso.dwt");
                    }
                    Document doc 
= Application.DocumentManager.MdiActiveDocument;

                    DocumentLock lockDoc 
= doc.LockDocument();
                    
using (lockDoc)
                    {
                        
//处理db中的块等实体
                    }

 

posted @ 2010-01-12 15:06  houlinbo  阅读(258)  评论(0编辑  收藏  举报