|
static void zoomExtents()
{
AcDbViewTableRecord view;
AcGePoint3d max = acdbHostApplicationServices()->workingDatabase()->extmax(),
min = acdbHostApplicationServices()->workingDatabase()->extmin();
AcGePoint2d max_2d (max[X], max[Y]);
AcGePoint2d min_2d (min[X], min[Y]);
view.setCenterPoint (min_2d + (max_2d - min_2d) / 2.0);
view.setHeight(max_2d[Y] - min_2d[Y]);
view.setWidth (max_2d[X] - min_2d[X]);
acedSetCurrentView (&view, NULL);
acdbHostApplicationServices()->workingDatabase()->updateExt(TRUE);
}
static void SetDwgWindow_SetWindow(void) {
//
// Set Variables
//
// Client Borders,Sliders,Ect.
int Width = 0; // ViewAreaWidth(802) + 28 = Width = 830
int Height = 0; // ViewAreaHeight(493) + 71 = Height = 564
acedGetInt (_T("\nEnter a new width in pixels for the drawing window: "), &Width);
acedGetInt (_T("\nEnter a new height in pixels for the drawing window: "), &Height);
CRect rect (0, 0, 2 * Width, 2 * Height);
CRect ChildRect (0, 0, Width, Height);
AcGePoint3d Min (0, 0, 0);
AcGePoint3d Max (830, 564, 0);
//
// Resize Document Frame
//
CWnd* DocFrame = acedGetAcadDwgView()->GetParent();
DocFrame->MoveWindow (ChildRect);
DocFrame->UpdateWindow ();
zoomExtents();
DocFrame->SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0L);
DocFrame->SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0L);
DocFrame->SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0L);
}//SetDwgWindow
|
|