!!急(关于CScrollview)

xh 2000-01-27 09:41:00
我开发了一应用程序,可是当用void SetScrollSizes( int nMapMode, SIZE sizeTotal, const SIZE& sizePage = sizeDefault, const SIZE& sizeLine = sizeDefault )进行设置滚动尺寸时,如果sizeTotal.cx(因sizeTotal.cy总是为800)设置的值较大时,总时出现问题?为什么?
...全文
156 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
xh 2000-01-27
  • 打赏
  • 举报
回复
PRB: CScrollView Scroll Range Limited to 32K

--------------------------------------------------------------------------------
The information in this article applies to:

The Microsoft Foundation Classes (MFC), included with:
Microsoft Visual C++, 32-bit Editions, versions 4.0, 4.1, 4.2, 5.0, 6.0

--------------------------------------------------------------------------------


SYMPTOMS
If the scroll range exceeds 32K when you are using the Scroll Thumb to scroll, CScrollView does not handle scrolling correctly. Unusual behavior occurs when you try to scroll beyond 32K.



CAUSE
This behavior is by design. The code to handle ranges greater than 32K was not added to CScrollView because it could fail if a WM_xSCROLL message is sent to the view to programatically scroll the contents. In Visual C++, version 6.0 on Windows NT, the limit has been extended to 2 gigabytes.



RESOLUTION
You can work around the problem easily by adding support to handle scroll ranges greater than 32K to a CScrollView derived class. Override the function as follows:

BOOL CMyScrollView::OnScroll(UINT nScrollCode, UINT nPos, BOOL
bDoScroll)
{
SCROLLINFO info;
info.cbSize = sizeof(SCROLLINFO);
info.fMask = SIF_TRACKPOS;

if (LOBYTE(nScrollCode) == SB_THUMBTRACK)
{
GetScrollInfo(SB_HORZ, &info);
nPos = info.nTrackPos;
}

if (HIBYTE(nScrollCode) == SB_THUMBTRACK)
{
GetScrollInfo(SB_VERT, &info);
nPos = info.nTrackPos;
}

return CScrollView::OnScroll(nScrollCode, nPos, bDoScroll);
}
NOTE: If you are trying to programatically scroll the contents in CscrollView, use the SetScrollInfo to correctly set the scroll bar information and then send or post the WM_xSCROLL message.

NOTE: Windows 98, Windows 95 and Win32s only support logical and device coordinates up to 32K. Because CScrollView uses logical units in SetScrollSizes(), you should specify a scroll range < 32K on when using CSrollView derived classes on these operating systems.

(c) Microsoft Corporation 1997, All Rights Reserved. Contributions by Sridhar S. Madhugiri, Microsoft Corporation

Additional query words: CScrollView scrolling

Keywords : kbprg kbusage kbMFC KbUIDesign kbVC kbVC400 kbVC410 kbVC420 kbVC500 kbVC600
Version : 4.0 4.1 4.2 5.0 6.0
Platform : NT WINDOWS
Issue type : kbprb
zdg 2000-01-27
  • 打赏
  • 举报
回复
出什么问题???

16,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧