delphi - 右滚动文字

2022-12-26 10:51:09 作者:admin

本文整理自网络,侵删。

 procedure TForm1.Timer2Timer(Sender: TObject);const{$WRITEABLECONST ON}  ScrollingText : string = 'This is right scrolling text ';{$WRITEABLECONST OFF}var  ScrollPosition: Integer;begin  Label2.Caption := ScrollingText;  for ScrollPosition := (Length(ScrollingText) - 1) downto 2 do    begin      ScrollingText[ScrollPosition] := Label2.Caption[ScrollPosition - 1];      ScrollingText[1] := Label2.Caption[Length(ScrollingText) - 1];    end;end;

但是我建议不要使用可写常量,也不要使用for循环:
procedure TForm1.FormCreate(Sender: TObject);begin  ...  Label2.Caption := 'This is right scrolling text ';end;
procedure TForm1.Timer2Timer(Sender: TObject);var  S: String;begin  S := Label2.Caption;  S := S[Length(S)] + Copy(S, 1, Length(S) - 1);  Label2.Caption := S;end;

相关阅读 >>

Delphi tscreen 类 - 通过 screen 更换光标

Delphi getwindowtext - 获取窗口标题

Delphi 用cxgrid显示联合查询数据和更改数据

Delphi webbrowser控件属性介绍

Delphi dcc32.exe 参数说明

Delphi获取uri的查询参数

Delphi调用sql分页存储过程实例

Delphi 实现程序 动态 类名

Delphi 使用firedac的tfdscript组件执行文件中描述的sql语句

Delphi多媒体函数

更多相关阅读请进入《Delphi》频道 >>



在线咨询 拨打电话