如何停止自动滚动备忘录控件? [英] How to stop the automatic scrolling of a Memo control?

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

问题描述

在Windows 7中,一个备忘录控件( TMemo )将在文本发布后自动滚动( Memo.Lines.Add(Path); ),我不想要,因为滚动是由我自己完成的。

In Windows 7, a memo control (TMemo) will scroll automatically after text is insterted (Memo.Lines.Add(Path);), which I do not want, because scrolling is done by myself.

如何停止自动滚动?

推荐答案

通常,向备忘录控件添加文本将备忘录滚动到插入文本的底部。为了防止这种情况,请在添加文本之前调用 Lines.BeginUpdate ,然后调用 EndUpdate

Normally, adding text to a memo control scrolls the memo to the bottom of the inserted text. To prevent that, call Lines.BeginUpdate before adding text, and call EndUpdate afterwards:

procedure TForm1.Button1Click(Sender: TObject);
begin
  Memo1.Lines.BeginUpdate;
  try
    Memo1.Lines.Add('...');
    Memo1.Lines.Add('...');
    ...
  finally
    Memo1.Lines.EndUpdate;
  end;
end;

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

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