PRB: CScrollView::FillOutsideRect() Fills Incorrectly (117387)
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
This article was previously published under Q117387 SYMPTOMS
Calling CScrollView::FillOutsideRect() incorrectly fills the area outside
of the scrolling area that belongs to the CScrollView.
CAUSE
In the file VIEWSCRL.CPP, in the Visual C++ MFC\SRC directory,
FillOutsideRect() has the following implementation:
void CScrollView::FillOutsideRect(CDC* pDC, CBrush* pBrush)
{
ASSERT_VALID(pDC);
ASSERT_VALID(pBrush);
// Fill Rect outside the image
CRect rect;
GetClientRect(rect);
ASSERT(rect.left == 0 && rect.top == 0);
rect.left = m_totalDev.cy;
if (!rect.IsRectEmpty())
pDC->FillRect(rect, pBrush); // vertical strip along the side
rect.left = 0;
rect.right = m_totalDev.cy;
rect.top = m_totalDev.cy;
if (!rect.IsRectEmpty())
pDC->FillRect(rect, pBrush); // horizontal strip along the
// bottom
}
This implementation is incorrect because it sets rect.left and rect.right
to "m_totalDev.cy", instead of setting them equal to "m_totalDev.cx".
This causes the first rectangle filled to have its left border begin at the
coordinate "m_totalDev.cy" (the bottom border of the scrollable area of the
view) when it should be at the coordinate of the right border of the view
(that is, "m_totalDev.cx"). Similarly, the second rectangle filled has its
right border ending at the coordinate "m_totalDev.cy" (always the bottom
border of the scrollable area of the view) when it should be at the
coordinate of the right border of the view.
RESOLUTION
Modify the MFC source file, VIEWSCRL.CPP, to read as follows:
rect.left = m_totalDev.cx;
rect.right = m_totalDev.cx;
Rebuild the MFC libraries with this change. The README.TXT file in the
Visual C++ MFC\SRC directory describes how to do this.
NOTE: You will need to have your system configured to build from the
command prompt. Running the MSVCVARS.BAT or VCVARS32.BAT file in your BIN
directory sets your environment correctly.
STATUS
Microsoft has confirmed this to be a bug in the products listed at the
beginning of this article. This problem was corrected in the MFC 3.0
included with Visual C++ 2.0.
Modification Type: | Major | Last Reviewed: | 11/18/2003 |
---|
Keywords: | kbBug kbDocView kbfix kbprb kbVC200fix KB117387 |
---|
|