FIX: ResizeParentToFit Won't Work w/ CScrollView on Windows 95Last reviewed: September 18, 1997Article ID: Q135118 |
2.20
WINDOWS NT
kbprg kbbuglist kbfixlist
The information in this article applies to:
SYMPTOMSA CScrollView that uses ResizeParentToFit to force its parent to resize itself such that the client area is the same size as the CScrollView doesn't work properly. The parent frame window will be very nearly the correct size, but it will still have vertical and horizontal scroll bars. CFormView, which is derived from CScrollView, will have the same problem.
CAUSEThe bug is in the ResizeParentToFit function. The ResizeParentToFit function does not properly account for cases where the child window is not located at location (0,0). The version of Visual C++ listed at the top of this article has been modified. MFC was changed so that a CFormView will have the properly sunken-edge (or 3D) look that a client window should have under Windows 95. This change was done by adding the WS_EX_CLIENTEDGE style to all CFormView objects when they are created. Because of this change the client area of the CFormView is no longer at position (0,0), so ResizeParentToFit fails to work correctly.
RESOLUTIONOverride the ResizeParentToFit function, and modify it to do the proper calculations for your CFormView-derived class. The code for ResizeParentToFit can be found in the \MSVC20\MFC\SRC directory in the Viewscrl.cpp file. Implement this code in your application by first declaring it in your class, as in this example: protected: void ResizeParentToFit(BOOL bShrinkOnly = TRUE);Implement the ResizeParentToFit function. To do this, copy the existing implementation from Viewscrl.cpp, and then make the following changes in your implementation:
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem was corrected in the version of MFC that ships with Microsoft Visual C++, 32-bit Edition, version 4.0.
|
Additional reference words: 2.20 3.20 4.00 Windows 95
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |