private void pageSetupToolStripMenuItem_Click(object sender, EventArgs e) { using (DBObject pVpObj = Aux.active_viewport_id(database).GetObject(OpenMode.ForWrite)) { AbstractViewportData pAVD = new AbstractViewportData(pVpObj); pAVD.SetView(helperDevice.ActiveView); } TransactionManager tm = database.TransactionManager; using (Transaction ta = tm.StartTransaction()) { using (BlockTableRecord blTableRecord = (BlockTableRecord)database.CurrentSpaceId.GetObject(OpenMode.ForRead)) { using (Layout pLayObj = (Layout)blTableRecord.LayoutId.GetObject(OpenMode.ForWrite)) { PlotSettings ps = (PlotSettings)pLayObj; Print.PageSetup pageSetupDlg = new Print.PageSetup(ps); if (pageSetupDlg.ShowDialog() == DialogResult.OK) { ta.Commit(); } else { ta.Abort(); } } } } }
// the same as Editor.ActiveViewportId if ApplicationServices are available private void zoom_extents_handler(object sender, EventArgs e) { using (DBObject pVpObj = Aux.active_viewport_id(database).GetObject(OpenMode.ForWrite)) { // using protocol extensions we handle PS and MS viewports in the same manner AbstractViewportData pAVD = new AbstractViewportData(pVpObj); Teigha.GraphicsSystem.View pView = pAVD.GsView; // do actual zooming - change GS view zoom_extents(pView, pVpObj); // save changes to database pAVD.SetView(pView); pAVD.Dispose(); pVpObj.Dispose(); Invalidate(); } }