DELPHI Memo1自动循环上下滚屏


本文整理自网络,侵删。

 DELPHI Memo1自动循环上下滚屏  



--------------Start--------------------

procedure TForm1.Timer1Timer(Sender: TObject);
begin
if Memo1.Perform(EM_SCROLL,SB_LINEDOWN,0)=0 then
begin
Memo1.Perform(WM_VSCROLL,SB_TOP,0);
end
else
begin
SendMessage(Memo1.Handle,WM_VSCROLL,SB_LINEDOWN,0);
end;
end;

--------------End--------------------

---希望对做屏幕滚动的朋友,有实际的使用价值.



// 执行到底 SendMessage(Memo1.Handle, EM_SCROLL, SB_BOTTOM, 0);
//一步一步往下走 SendMessage(Memo1.Handle,WM_VSCROLL,SB_LINEDOWN,0);
// 往下走 SendMessage(Memo1.Handle,EM_SCROLL,SB_PAGEDOWN,0);

if Memo1.Perform(EM_SCROLL, SB_LINEDOWN, 0)=0 then//下滚
button2.Enable := False;
if Memo1.Perform(EM_SCROLL, SB_LINEUP, 0)=0 then//上滚
button1.Enable := False;


如何编程使Memo的滚动条滚到行首?

发送消息:
WPARAM para = MAKELONG(SB_THUMBPOSITION,0);//将滚动条移动到0
SendMessage(Memo1->Handle,WM_VSCROLL,para,0);

Memo1->Perform(EM_SCROLL, SB_TOP, 0); //第一行
Memo1->Perform(EM_SCROLLCARET,0,0); //自动滚动到最后一行

改进一下:
Memo1->Lines->BeginUpdate();
Memo1->Perform(WM_VSCROLL,SB_TOP,0); //先回到顶部
for(int i=0; i<1500; ++i) //向下滚1500行
Memo1->Perform(WM_VSCROLL,SB_LINEDOWN,0);
Memo1->Lines->EndUpdate();



移到指定位置,发送消息 吧
WPARAM para = MAKELONG(SB_THUMBPOSITION,50);//将滚动条移动到50 Position
//具体参数请看win32帮助有关于WM_VSCROLL的帮助
// Memo1->Perform(WM_VSCROLL,para,0); //这个也行
SendMessage(Memo1->Handle,WM_VSCROLL,para,0);

相关阅读 >>

Delphi 利用thttpclient实现http异步下载

Delphi android权限

Delphi 检验手机号 ismobilenumber

Delphi 解决strtodatetime()不是有效日期类型的问题

Delphi安全结束线程

Delphi winapi: getwindowthreadprocessid - 获取指定窗口的进程 id 或线程 id

Delphi tapplication.onexception

Delphi ini 文件操作记要: 使用 tmeminifile

Delphi cxgrid中回车键光标移到下列

Delphi强制关闭执行程序(杀进程)

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...