社区
界面
帖子详情
请问Scroll的range,pos,page之间是什么关系
lanmu01
2010-04-05 11:48:19
我在CWnd中用SetScrollInfo添加滚动条,但是滚动的位置总是不对。
请问Scroll的range,pos,page之间是什么关系
还有我希望初始状态是无效的,就是有滚动条,没有滑块,而且滚动条灰显。应该如何做?
...全文
129
4
打赏
收藏
请问Scroll的range,pos,page之间是什么关系
我在CWnd中用SetScrollInfo添加滚动条,但是滚动的位置总是不对。 请问Scroll的range,pos,page之间是什么关系 还有我希望初始状态是无效的,就是有滚动条,没有滑块,而且滚动条灰显。应该如何做?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
向立天
2010-04-14
打赏
举报
回复
您好
我是本版版主
此帖已多日无人关注
请您及时结帖
如您认为问题没有解决可按无满意结帖处理
另外本版设置了
疑难问题汇总帖
并已在版面置顶
相关规定其帖子中有说明
您可以根据规定提交您帖子的链接
如您目前不想结帖只需回帖说明
我们会删除此结帖通知
见此回复三日内无回应
我们将强制结帖
相关规定详见界面
界面版关于版主结帖工作的具体办法
lanmu01
2010-04-06
打赏
举报
回复
MSDN我看了,但是还是搞不太明白
Eleven
2010-04-06
打赏
举报
回复
MSDN...
lanmu01
2010-04-06
打赏
举报
回复
在线等~各位帮帮忙
界面技术-对话框的内容滚动显示.doc
Selecting the "Horizontal
Scroll
" and "Verticla
Scroll
" styles among the properties of your dialog box in the resource editor, you can add
scroll
bars to the dialog box. Remember also to select the 'resizing' border style. However for adding functionality to the
scroll
bars, you need to override the WM_V
SCROLL
and WM_H
SCROLL
message handlers. Also,override the WM_SIZE handler to set the
scroll
bar
range
if the size is reduced than the original. So you get the original size of the dialog in your OninitDialog(). The code would look something like this. Modify to your needs. 1. To OnInitDialog(),add the following line. GetWindowRect(m_rect); m_n
Scroll
Pos
= 0; to get the original window size. Make m_rect a member variable of your dialog. Add another variable m_n
Scroll
Pos
and initialize its value to zero. It stores the current vertical
scroll
pos
ition. 2. Here is the WM_SIZE handler for setting the
scroll
bar
range
.Set
range
0 if size is increased more than original. void CCharlesDlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); // TODO: Add your message handler code here m_nCurHeight = cy; int n
Scroll
Max; if (cy < m_rect.Height()) { n
Scroll
Max = m_rect.Height() - cy; } else n
Scroll
Max = 0;
SCROLL
INFO si; si.cbSize = sizeof(
SCROLL
INFO); si.fMask = SIF_ALL;// SIF_ALL = SIF_
PAGE
| SIF_
RANGE
| SIF_
POS
; si.nMin = 0; si.nMax = n
Scroll
Max; si.n
Page
= si.nMax/10; si.n
Pos
= 0; Set
Scroll
Info(SB_VERT, &si, TRUE); } You need m_nCurHeight to store the current height of the dialog and use it to handle the
scroll
ing in OnV
Scroll
. m_ncurHeight is also a member variable of the dialog. 3. Here is the handler for WM_V
SCROLL
. void CCharlesDlg::OnV
Scroll
(UINT nSBCode,UINT n
Pos
,C
Scroll
Bar* p
Scroll
Bar) { //TODO:Add your message handler code here and/or call default int nDelta; int nMax
Pos
= m_rect.Height() - m_nCurHeight; switch(nSBCode) { case SB_LINEDOWN: if (m_n
Scroll
Pos
>= nMax
Pos
) return; nDelta = min(nMax
Pos
/100,nMax
Pos
-m_n
Scroll
Pos
); break; case SB_LINEUP: if (m_n
Scroll
Pos
<= 0) return; nDelta = -min(nMax
Pos
/100,m_n
Scroll
Pos
); break; case SB_
PAGE
DOWN: if (m_n
Scroll
Pos
>= nMax
Pos
) return; nDelta = min(nMax
Pos
/10,nMax
Pos
-m_n
Scroll
Pos
); break; case SB_THUMB
POS
ITION: nDelta = (int)n
Pos
- m_n
Scroll
Pos
; break; case SB_
PAGE
UP: if (m_n
Scroll
Pos
<= 0) return; nDelta = -min(nMax
Pos
/10,m_n
Scroll
Pos
); break; default: return; } m_n
Scroll
Pos
+= nDelta; Set
Scroll
Pos
(SB_VERT,m_n
Scroll
Pos
,TRUE);
Scroll
Window(0,-nDelta); CDialog::OnV
Scroll
(nSBCode, n
Pos
, p
Scroll
Bar); } The above code handles the vertical
scroll
ing. For horizontal
scroll
ing add the WM_H
SCROLL
similarly and add the necessary code to OnSize and OnInitDialog. Information provided in this document and any software that may accompany this document is provided "as is" without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular pur
pos
e. The user assumes the entire risk as to the accuracy and the use of this information.
4滚动条
SCROLL
BAR
(1) 添加水平滚动条 IDC_
SCROLL
变量m_
javascript必修课_offset,client,
scroll
家族
本课将带你学习前端开发中最重要的技术JavaScript,它是网页与用户进行交互的基石。...最后我们还会学习Jquery框架,以提高你的前端开发效率。学完本课后,你将能独立做出与用户有复杂交互(表单、动画、视频等)的网站...
Scroll
2
#include <Windows.h> #include <stdio.h> #include "resource.h" //#include <afxwin.h> LRESULT CALLBACK MyWindowProc( HWND hwnd, UINT uMsg, WPARAM wPar...
VS2010/MFC编程入门之二十六(常用控件:滚动条控件
Scroll
Bar)
回顾上一节,鸡啄米讲的是组合框控件Combo Box的使用。本节详解滚动条控件
Scroll
Bar的相关内容。 滚动条控件简介 滚动条大家也很熟悉了,Windows窗口中很多都有滚动条。前面讲的列表框和组合框设置了相应属性后,如果列表项显示不下也会出现滚动条。滚动条分为水平滚动条(Horizontal
Scroll
Bar)和垂直滚动条(Vertical Scrol
界面
15,978
社区成员
115,896
社区内容
发帖
与我相关
我的任务
界面
VC/MFC 界面
复制链接
扫一扫
分享
社区描述
VC/MFC 界面
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章