nicholso
asked on
resizing an MDI parent window
I need to resize the parent window in an MDI app, after
the program has started, so I can't override
PreCreateWindow. I'm displaying an image in the child
window, so I need to wait until I have loaded it to
resize the parent to be exactly the size of the image; is
there a command to resize the main frame?
the program has started, so I can't override
PreCreateWindow. I'm displaying an image in the child
window, so I need to wait until I have loaded it to
resize the parent to be exactly the size of the image; is
there a command to resize the main frame?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
// obtain a pointer to the child's parent window
CWnd *pWndParent = GetParent();
// now get size of the current child window (including borders)
CRect rcChildRect;
GetWindowRect( &rcChildRect );
// next set the size of the parent window to that of the child
// NOTE: the TRUE parameter forces a redraw on the parent
// window
pWndParent->MoveWindow( &rcChildRect, TRUE );
// finally update the parent window
pWndParent->UpdateWindow()