滚动RichEdit没有它的焦点 [英] Scrolling RichEdit without it having focus

查看:353
本文介绍了滚动RichEdit没有它的焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在添加行后,我需要滚动一个RichEdit到最后。我有这个RichEdit在一个单独的形式,我不想得到焦点。我经常提出解决方案:

  RichEdit.Lines.Add(someText); 
RichEdit.SelStart:= RichEdit.GetTextLen;
SendMessage(RichEdit.handle,EM_SCROLLCARET,0,0);

但这对我来说不起作用。然而,当我使用 RichEdit.SetFocus; 调用 SendMessage 之前,我集中了RichEdit,它的工作原理很好。但是,这个应用程序遗失了我的其他需求。



我正在使用XE2。谢谢

解决方案

这是我做的:

  SendMessage(RichEdit.Handle,WM_VSCROLL,SB_BOTTOM,0); 


I need to scroll a RichEdit to the very end after a line is added. I have this RichEdit in a separate form, that I don't want to get focus at all. I tried often suggested solution:

RichEdit.Lines.Add(someText);
RichEdit.SelStart:=RichEdit.GetTextLen;
SendMessage(RichEdit.handle, EM_SCROLLCARET, 0, 0);

But this doesn't work for me. However, when I focus the RichEdit before calling the SendMessage using RichEdit.SetFocus; it works just fine. That, however, ruins my other needs for the app.

I'm using XE2. Thanks

解决方案

This is what I do:

SendMessage(RichEdit.Handle, WM_VSCROLL, SB_BOTTOM, 0);

这篇关于滚动RichEdit没有它的焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆