- public void ImageFrame()
- {
- Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database;
- Autodesk.AutoCAD.DatabaseServices.TransactionManager tm = db.TransactionManager;
- using (Transaction t = tm.StartTransaction())
- {
- DBDictionary dict = tm.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForRead) as DBDictionary;
- RasterVariables rasterVars;
- string kImageVars = "ACAD_IMAGE_VARS";
- if(dict.Contains(kImageVars))
- {
- ObjectId rastVarsId = dict.GetAt(kImageVars);
- rasterVars = tm.GetObject(rastVarsId,OpenMode.ForWrite) as RasterVariables;
-
- }
- else
- {
- rasterVars = new RasterVariables();
- dict.UpgradeOpen();
- dict.SetAt(kImageVars,rasterVars);
- tm.AddNewlyCreatedDBObject(rasterVars,true);
-
- }
- rasterVars.ImageFrame = FrameSetting.ImageFrameOff;
- t.Commit();
-
- }
- }
这是我修改成的C#的代码,运行之后发现ImageFrame的值确实改了,用自带命令“IMAGEFRAME”也可以看到其值是0,也就是边框关掉了,
但是边框还是在图上显示得好好的!还是不行!
|