richedit设置滚动条的位置和更新内容
需要txt发现读者richedit的scrollbar位置(为了便于下一次读,直接访问与上次读取下一个读取位置)不值得治疗,采用GetScrollPos、SetScrollPos你可以设置scorllbar位置值。可是!
SetScorllPos调用后仅仅更新了scorllbar的位置richedit的内容没得到更新,google一下没有个现成的解决。仅仅得msdn。
WM_VSCROLL重点标记一下:
|
The user has dragged the scroll box (thumb) and released the mouse button. The HIWORD indicates |
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.
SeeGetScrollInfo for
a description of the technique.
GetScrollInfo重点标记一下:
-
- SIF_TRACKPOS
Copies the current scroll box tracking position to the nTrackPosmember of the SCROLLINFO structure
pointed to by lpsi.Remarks
The GetScrollInfo function enables applications to use 32-bit scroll positions. Although the messages that indicate scroll bar position, WM_HSCROLL and WM_VSCROLL,
provide only 16 bits of position data, the functions SetScrollInfo and GetScrollInfo provide
32 bits of scroll bar position data. Thus, an application can call GetScrollInfo while processing either theWM_HSCROLL or WM_VSCROLL messages to obtain 32-bit scroll bar position data.To get the 32-bit position of the scroll box (thumb) during a SB_THUMBTRACK request code in a WM_HSCROLL or WM_VSCROLL message,
call GetScrollInfo with the SIF_TRACKPOS value in the fMask member of the SCROLLINFO structure.
The function returns the tracking position of the scroll box in the nTrackPos member of the SCROLLINFO structure. This allows you to get the position of the scroll box as the user moves it. The following sample code illustrates
the technique.SCROLLINFO si;
case WM_HSCROLL:
switch(LOWORD(wparam)) {
case SB_THUMBTRACK:
// Initialize SCROLLINFO structure ZeroMemory(&si, sizeof(si));
si.cbSize = sizeof(si);
si.fMask = SIF_TRACKPOS; // Call GetScrollInfo to get current tracking
// position in si.nTrackPos if (!GetScrollInfo(hwnd, SB_HORZ, &si) )
return 1; // GetScrollInfo failed
break;
.
.
.
}
//保存scrollbar位置
SCROLLINFO Info={0};
Info.cbSize=sizeof Info;
Info.fMask=SIF_TRACKPOS;
GetScrollInfo(RichEdit1->Handle,SB_VERT,&Info);
std::auto_ptr<TIniFile> ptrIni(new TIniFile(ExtractFilePath(Application->ExeName)+"Config"));
ptrIni->WriteInteger("Reader","ScorllPos",Info.nTrackPos); //设置scrollbar位置
std::auto_ptr<TIniFile> ptrIni(new TIniFile(ExtractFilePath(Application->ExeName)+"Config"));
int pos=ptrIni->ReadInteger("Reader","ScorllPos",0);
SendMessage(RichEdit1->Handle,WM_VSCROLL,MAKEWPARAM(SB_THUMBPOSITION,pos),0);
版权声明:本文博主原创文章,博客,未经同意不得转载。
richedit设置滚动条的位置和更新内容的更多相关文章
- javascript设置网页刷新或者重新加载后滚动条的位置不变
有个同事说再javascript中你可以做任何你想做的事情,当时觉得不以为然,今天遇到个问题,就是页面重新加载后总是回到页面的顶部,如果客户只想看到他想看到的部分是怎么变化的,这个体验就好了.原本想象 ...
- java中JTextPane使输出字符到指定的宽度换行,并将垂直滚动条的位置移动到输出的最后位置
SimpleAttributeSet set = new SimpleAttributeSet(); Document doc = tp.getStyledDocument(); FontMetric ...
- jQuery:实现图片按需加载的方法,当要显示内容的高度超过了页面的高度,按需加载,根据滚动条的位置来判断页面显示的内容
实现图片按需加载的方法,当要显示内容的高度超过了页面的高度,按需加载,根据滚动条的位置来判断页面显示的内容 这个类似于京东或淘宝页面,根绝页面的滚动,显示下面的内容 如下图所示,一开始并不是所有的图片 ...
- js设置滚动条位置
JS控制滚动条的位置: window.scrollTo(x,y); 竖向滚动条置顶(window.scrollTo(0,0); 竖向滚动条置底 window.scrollTo(0,document.b ...
- 关于div的滚动条滚动到底部,内容显示不全的问题。(已解决)
今天我做了一个带有滚动条,底部有两个按钮的div. 当我拖动滚动条到底部, 按钮没有显示出来. 我看了看我的样式设置,是这样的: /* 内容样式 */ #contentPartDiv{ posit ...
- 原生JS获取各种高度宽度、浏览器窗口滚动条的位置、元素的几何尺寸名
1)关于 pageX, clienX,offsetX,layerX pageX:鼠标在页面上的位置,从页面左上角开始,即是以页面为参考点,不随滑动条移动而变化 clientX:鼠标在页面上可视区域的位 ...
- javascript控制滚动条的位置,获取控件的位置
一.如下是定位鼠标在视窗中的位置,先定位视窗和页面直接的距离. function getMousePoint() { var point = {x:0,y:0}; // 如果浏览器支持 pageYOf ...
- jquery设置滚动条样式
HTML结构 下面是该滚动条插件工作所必须的HTML结构: <div id="about" class="nano"> <div cl ...
- (数据科学学习手札124)pandas 1.3版本主要更新内容一览
本文示例代码及文件已上传至我的Github仓库https://github.com/CNFeffery/DataScienceStudyNotes 1 简介 就在几天前,pandas发布了其1.3版本 ...
随机推荐
- ffmpeg 频中分离 video audio 截取片断
1.获取视频的信息 ffmpeg -i video.avi 2,将图片序列分解合成视频 ffmpeg -i src.mpg image%d.jpg ffmpeg -f image2 -i ...
- C编译: makefile基础
作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! 在编译一个大型项目的时候,往往有很多目标文件.库文件.头文件以及最终的可执行文件. ...
- Android拖动和缩放图片
Android拖动和缩放图片 2014年5月9日 我们在使用应用其中常常须要浏览图片.比方在微信其中.点击图片之后能够对图片进行缩放. 本博客介绍怎样对图片进行拖拽和缩放.这首先要了解Android中 ...
- Boost中timer的简易用法
boost::asio::deadline_timer timer_; timer_(io_service), timer_.expires_from_now(boost::posix_time::s ...
- Windows编程之非模态对话框
1 创建非模态对话框 <1> HWNDCreateDialog( HINSTANCE hInstance, // handle to module LPCTSTRlpTemplat ...
- zoj3201(树形dp)
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3201 题意:给一棵树, n结点<=1000, 和K < ...
- 泛泰A850 (高通8064+720p)刷4.4专用中文recovery TWRP2.7.1.3版
欢迎关注泛泰非盈利专业第三方开发团队 VegaDevTeam (本team 由 syhost suky zhaochengw(z大) xuefy(大星星) tenfar(R大师) loogeo cr ...
- Apache的Mesos和Google的Kubernetes 有什么区别?
Apache的Mesos和Google的Kubernetes 有什么区别?本文来自StackOverFlow上的一个问题,主要讨论Mesos和Kubernetes的区别,相信我们很多人也有同意的疑问. ...
- Spring jdbc 对象Mapper的简单封装
一般查询实体的时候,都需要这么使用/** * 根据id查询 * * @return */ public Emp queryEmpById(Intege ...
- poj3694(动态询问割桥的数目)
给我们一个图,然后有q次加边的操作,问每次加完边之后有多少个桥存在 首先用dfs求出所有的桥,然后dfs的过程中生成了一棵dfs树,该树有的边是桥,有的不是,用bridge[v] = true , 表 ...