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版本 ...
 
随机推荐
- iOS 搜索框控件 最简单的dome
			
刚学习搜索框控件,写了个最简单的dome #import <UIKit/UIKit.h> .h @interface ViewController : UIViewController&l ...
 - vim忽略大写和小写查找配置
			
作者:zhanhailiang 日期:2014-12-17 默认 vim 的查找是区分大写和小写,可通过下面两种方式实现忽略大写和小写查找 set ic? noignorecase 1 指令设定: : ...
 - Struts2 学习第一步准备工作
			
第一步:安装下载MyEclispe10 对于MyEclispe的下载安装就不再详述了. 第二步:下载Struts-2.3.15 Struts-2.3.15下载地址: http://struts.apa ...
 - 再探vim经常使用命令
			
 最開始学习过vim,见 http://blog.csdn.net/u011848617/article/details/12837873 之后以前不了了之,当再次学习后,发现经常使用命令的掌握还 ...
 - 【filezilla】 ubuntu下安装filezilla
			
sudo apt-get install filezilla '安装filezilla3.6.02 filezilla '执行filezilla
 - tomcat启动Flash退出错误不能被视为解决该错误信息
			
tomcat 当有错误 启动startup.bat闪存在退出解决方案 打开 startup.bat 文件 最后 该start 阅读run watermark/2/text/aHR0cDovL2Jsb2 ...
 - ecshop 后台批量上传商品   完整上传
			
ecshop 后台批量上传商品,之所以无法上传,是因为后台上传php文件方法中没有导入商品原图路径 将ecshop根目录中的admin/goods_batch.php文件全部修改为 <?php ...
 - Linux应用环境实战05:在Ubuntu 14.10中借用Windows的字体 (转)
			
阅读目录 设置系统字体 安装微软的英文字体 查看系统的配置文件 借用Windows的字体 编写配置文件 在前一篇随笔中,我详细讨论了字体的分类及用途,也以Fedora 20为例,展示了字体配置的思路和 ...
 - LeetCode——Valid Sudoku
			
Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be ...
 - Android---53---多线程下载
			
采用HttpURLConnection HttpURLConnection从继承URLConnection,它也可以被用来发送到指定的网站GET求 POST求. 办法: int getResponse ...