我需要为用户提供一条消息,消息的长度大于可用空间。
使用哪个控件并不重要,我正在寻找一种方法来了解文本何时不完全可见以及如何应用滚动效果(更精确地向左滚动文本,直到所有显示隐藏文本并永远重复一遍)。
我正在使用Delphi XE7.1
答案 0 :(得分:0)
使用标准RTL控件在Delphi XE7中滚动字幕:
procedure TForm1.Button1Click(Sender: TObject);
begin
FloatAnimation1.Enabled := True;
FloatAnimation1.StartValue := Form1.Width;
FloatAnimation1.StopValue := 0-Label1.Width;
end;
object Label1: TLabel
AutoSize = True
Position.X = 240.000000000000000000
Position.Y = 232.000000000000000000
Size.Width = 37.000000000000000000
Size.Height = 16.000000000000000000
Size.PlatformDefault = False
TextSettings.WordWrap = False
Text = 'Label1'
object FloatAnimation1: TFloatAnimation
Duration = 1.000000000000000000
Loop = True
PropertyName = 'Position.X'
StartValue = 0.000000000000000000
StartFromCurrent = True
StopValue = 0.000000000000000000
end
end
object Button1: TButton
Position.X = 248.000000000000000000
Position.Y = 312.000000000000000000
TabOrder = 1
Text = 'Button1'
OnClick = Button1Click
end