使用 TTimer 滚动备忘录文本仅显示前 3 行
我现在想做的是使用 TMemo 组件和 TTimer 创建滚动信用文本,
procedure TAboutBox.Timer1Timer(Sender: TObject);
begin
Memo1.ScrollBy(0,-1);
end;
Tmemo 行包含信用文本,类似于:
谢谢:
Junifer lamda
示例用户2
Coder Monalisa
等
一切都按预期工作,我已将timer.interval设置为1ms,文本滚动平滑,但它仅显示前3行,然后显示空白,除非我单击并拖动在备忘录中手动使用鼠标,然后它显示一些行,然后当我释放时它再次消失。
我尝试使用 TRichedit 和 TListBox 但问题仍然存在。怎么会这样?
what i am trying to do right now is to create a scroling credit text using the TMemo component and TTimer
procedure TAboutBox.Timer1Timer(Sender: TObject);
begin
Memo1.ScrollBy(0,-1);
end;
the Tmemo lines contain the text of the credit, something like :
Thankyou to :
Junifer lamda
Exemple user 2
Coder Monalisa
etc etc
Everything work as expected, i've set the timer.interval to 1ms , the text scroll smoothly but it displays only the 3 first lines then it displays a blank space, unless i click and drag manually using the mouse inside the memo, then it displays some lines then it disappears again when i release.
I tried with both TRichedit and TListBox but the problem persist. How could this be ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在我看来,
ScrollBy
并不是为了做你想做的事情而设计的。更重要的是,我认为TMemo
也没有必要。我可能会用标签来做到这一点并将其移动到计时器事件上。像这样:
我发现我需要使表单双缓冲(
DoubleBuffered := True
)以避免滚动时闪烁。It seems to me that
ScrollBy
is not designed to do what you desire. What's more I don't think thatTMemo
is necessary either.I'd probably do this with a label and move it on the timer event. Like this:
I found that I needed to make the form double buffered (
DoubleBuffered := True
) to avoid flicker when scrolling.