FIX: ResizeParentToFit Doesn't Work in SDI CFormViews

Last reviewed: September 18, 1997
Article ID: Q113585
1.00 WINDOWS kbprg kbfixlist kbbuglist

The information in this article applies to:

  • The Microsoft Foundation Classes (MFC), included with: Microsoft Visual C++ for Windows, 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:

   ARTICLE-ID: Q98598
   TITLE     : 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 reference words: 1.00 2.00
KBCategory: kbprg kbfixlist kbbuglist
KBSubcategory: MfcDocView
Keywords : kb16bitonly MfcDocView kbbuglist kbfixlist kbprg
Technology : kbMfc
Version : 1.00
Platform : WINDOWS
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 18, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.