FIX: Assertion, VIEWSCRL.CPP, Line 455 with SetScaleToFitSize (113588)
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
This article was previously published under Q113588 SYMPTOMS
Calling SetScaleToFitSize in OnInitialUpdate of a CFormView derived class
causes the following assertion to fail:
File viewscrl.cpp, Line 455, Assertion Failed!
CAUSE
Because the view window has not yet been displayed, SetScaleToFitSize()
uses the size of the CFormView. Because the CFormView is created with size
CRect(0,0,0,0), the view size is miscalculated.
RESOLUTION
To set the view window size before calling SetScaleToFitSize, call
RecalcLayout on the parent frame. For example:
GetParentFrame()->RecalcLayout();
See the sample code below for an example of this.
STATUS
Microsoft has confirmed this to be a problem in the Microsoft Foundation
Classes (MFC) version 2.0. This problem was corrected in the Microsoft
Foundation Classes version 2.5.
Modification Type: | Major | Last Reviewed: | 10/24/2003 |
---|
Keywords: | kbBug kbDocView kbfix kbVC150fix KB113588 |
---|
|