문제

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.

How can I stop the automatic scrolling?

도움이 되었습니까?

해결책

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;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top