Microsoft KB Archive/113585

{|
 * width="100%"|

FIX: ResizeParentToFit Doesn't Work in SDI CFormViews

 * }

Q113585

-

The information in this article applies to:


 * The Microsoft Foundation Classes (MFC), included with:
 * Microsoft Visual C++, version 1.0

-

SYMPTOMS
Calling CScrollView::ResizeParentToFit(TRUE) in a CFormView's OnInitialUpdate to let the size of the view dictate the size of its frame window causes the frame window to become greatly enlarged.

CAUSE
Because the view window has not yet been displayed, ResizeParentToFit(TRUE) uses the size of the CFormView. The CFormView is created with size CRect(0,0,0,0), and therefore the view size is miscalculated and a rather large window is created.

RESOLUTION
Be sure to call GetParentFrame->RecalcLayout to set the view window's size correctly before calling ReSizeParentToFit(TRUE). For additional information, please see the following article(s) in the Microsoft Knowledge Base:

"Q98598 Using CFormView in SDI and MDI Applications"

STATUS
Microsoft has confirmed this to be a problem in the Microsoft Foundation Class Libraries version 2.0. This problem was corrected in the Microsoft Foundation Class Libraries version 2.5.

Additional query words: 1.00 2.00

Keywords : kb16bitonly kbDocView kbMFC kbVC

Issue type :

Technology : kbAudDeveloper kbMFC