?代碼如下:
using (Transaction tr = currentdb.TransactionManager.StartTransaction()){//當前數據庫開啟事務using (Database tempdb = new Database(false, true)) //創建臨時數據庫(兩個參數:是否創建符號表,不與當前文檔關聯){try{Bitmap thumb = doc.CapturePreviewImage(200, 300);tempdb.ThumbnailBitmap = thumb;}catch (System.Exception){ed.WriteMessage($"{fullfilename}無略縮圖。");} tempdb.ReadDwgFile(fileName, FileShare.Read, true, null);//臨時數據庫不打開dwg文檔讀取文件.只能讀取dwg類型文件,不可讀取dxftempdb.DxfOut(fullfilename,10,true);}counter = counter + 1;tr.Commit();}