如何自动滚动到RichEdit的末尾? [英] How to autoscroll to the end of RichEdit?

查看:536
本文介绍了如何自动滚动到RichEdit的末尾?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前从未使用过TRichEdit,而是一直使用TMemo.

I never needed to use the TRichEdit before, always used TMemo.

当我添加诸如TMemo之类的文本时,我希望RichEdit自动滚动到最后.查看添加数据后的外观:

I'd like RichEdit autoscrolling to the end when I add text like TMemo. See how it looks after you add some data:

如您所见,滚动条保留在顶部,但是我想在添加文本时将其保留在底部.

As you can see, the scroll bar remains at the top, but I'd like it stayed at the bottom as I added text.

我已经搜寻"了解决方案,但是找不到一个好的和可靠的解决方案.

I've 'googled' for solutions but I couldn't find a good and reliable one.

推荐答案

尝试此代码

RichEdit1.SetFocus;
RichEdit1.SelStart := RichEdit1.GetTextLen;
RichEdit1.Perform(EM_SCROLLCARET, 0, 0);

这篇关于如何自动滚动到RichEdit的末尾?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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