MFC单文本显示bmp图片时滚动条问题

qas12d 2016-12-01 01:43:03
MFC单文本窗口,在新建工程时已经选择了CScrollView,

为什么在用setDIBitstoDevice显示图片的时候最右边还是没有垂直滚动条?
...全文
179 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2016-12-02
  • 打赏
  • 举报
回复
阿源是少年 2016-12-02
  • 打赏
  • 举报
回复
你是不是重写了OnEraseBkgnd?如果是,需要用双缓冲
qas12d 2016-12-02
  • 打赏
  • 举报
回复
引用 3 楼 pcradio 的回复:
[quote=引用 2 楼 piaobotudou 的回复:]
看看这个 https://msdn.microsoft.com/en-us/library/3t073d82.aspx
主要讲的是用CScrollView::SetScrollSizes(
int nMapMode,
SIZE sizeTotal,
const SIZE& sizePage = sizeDefault,
const SIZE& sizeLine = sizeDefault);
设置总大小,页大小,才会有滚动条


就是这个,当你的sizePage大于sizeTotal时就会出现滚动条,对应你的例子,sizeTotal传入位图size,sizePage传入ScrollView的size[/quote]

谢谢,本人新手,实现滚动条后,但拖动滚动条图像出现重叠影,没有达到预期效果,请问这个有什么解决办法?
赵4老师 2016-12-02
  • 打赏
  • 举报
回复
MSDN98中的例子总体来说要比后代MSDN中的例子多得多! MSDN98_1.ISO http://pan.baidu.com/s/1dDF41ix, MSDN98_2.ISO http://pan.baidu.com/s/1bnGo0Vl
Eleven 2016-12-02
  • 打赏
  • 举报
回复
codeproject上使用搜索CScrollHelper类~
qas12d 2016-12-02
  • 打赏
  • 举报
回复
引用 6 楼 zhao4zhong1 的回复:
http://bbs.csdn.net/topics/390374955


赵老师好,我个人水平有限,我把samples(如图)找了大半天没有找到相应实例,由于我没有装csdn,您能不能给我发个实例?
阿源是少年 2016-12-01
  • 打赏
  • 举报
回复
引用 2 楼 piaobotudou 的回复:
看看这个 https://msdn.microsoft.com/en-us/library/3t073d82.aspx 主要讲的是用CScrollView::SetScrollSizes( int nMapMode, SIZE sizeTotal, const SIZE& sizePage = sizeDefault, const SIZE& sizeLine = sizeDefault); 设置总大小,页大小,才会有滚动条
就是这个,当你的sizePage大于sizeTotal时就会出现滚动条,对应你的例子,sizeTotal传入位图size,sizePage传入ScrollView的size
微型蚂蚁 2016-12-01
  • 打赏
  • 举报
回复
看看这个 https://msdn.microsoft.com/en-us/library/3t073d82.aspx 主要讲的是用CScrollView::SetScrollSizes( int nMapMode, SIZE sizeTotal, const SIZE& sizePage = sizeDefault, const SIZE& sizeLine = sizeDefault); 设置总大小,页大小,才会有滚动条
赵4老师 2016-12-01
  • 打赏
  • 举报
回复
重建所有? SetScrollRange The SetScrollRange function sets the minimum and maximum position values for the specified scroll bar. The SetScrollRange function is provided for backward compatibility. New applications should use the SetScrollInfo function. BOOL SetScrollRange( HWND hWnd, // handle to window with scroll bar int nBar, // scroll bar flag int nMinPos, // minimum scrolling position int nMaxPos, // maximum scrolling position BOOL bRedraw // redraw flag ); Parameters hWnd Handle to a scroll bar control or a window with a standard scroll bar, depending on the value of the nBar parameter. nBar Specifies the scroll bar to be set. This parameter can be one of the following values: Value Meaning SB_CTL Sets the range of a scroll bar control. The hWnd parameter must be the handle to the scroll bar control. SB_HORZ Sets the range of a window's standard horizontal scroll bar. SB_VERT Sets the range of a window's standard vertical scroll bar. nMinPos Specifies the minimum scrolling position. nMaxPos Specifies the maximum scrolling position. bRedraw Specifies whether the scroll bar should be redrawn to reflect the change. If this parameter is TRUE, the scroll bar is redrawn. If it is FALSE, the scroll bar is not redrawn. Return Values If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, callGetLastError. Remarks You can use SetScrollRange to hide the scroll bar by setting nMinPos and nMaxPos to the same value. An application should not call the SetScrollRange function to hide a scroll bar while processing a scroll bar message. New applications should use the ShowScrollBar function to hide the scroll bar. If the call to SetScrollRange immediately follows a call to the SetScrollPos function, the bRedraw parameter in SetScrollPos must be zero to prevent the scroll bar from being drawn twice. The default range for a standard scroll bar is 0 through 100. The default range for a scroll bar control is empty (both the nMinPos and nMaxPos parameter values are zero). The difference between the values specified by the nMinPos and nMaxPos parameters must not be greater than the value of MAXLONG. Because the messages that indicate scroll bar position, WM_HSCROLL and WM_VSCROLL, are limited to 16 bits of position data, applications that rely solely on those messages for position data have a practical maximum value of 65,535 for the SetScrollRange function's nMaxPos parameter. However, because the SetScrollInfo, SetScrollPos, SetScrollRange, GetScrollInfo, GetScrollPos, and GetScrollRange functions support 32-bit scroll bar position data, there is a way to circumvent the 16-bit barrier of the WM_HSCROLL and WM_VSCROLL messages. See GetScrollInfo for a description of the technique. QuickInfo Windows NT: Requires version 3.1 or later. Windows: Requires Windows 95 or later. Windows CE: Requires version 2.0 or later. Header: Declared in winuser.h. Import Library: Use user32.lib. See Also Scroll Bars Overview, Scroll Bar Functions, GetScrollInfo, GetScrollPos, GetScrollRange, SetScrollInfo, SetScrollPos, ShowScrollBar

19,469

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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