1、先添加一个Timer控件,其Interval属性设置为50。
2、再添加一个Label控件,Name为Label1。
3、然后在Timer的OnTimer事件添加如下代码:
unit Unit13; interface uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, jpeg; type
TForm13 = class(TForm)
Timer1: TTimer;
Label1: TLabel;
Image1: TImage;
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form13: TForm13; implementation {$R *.dfm} procedure TForm13.Timer1Timer(Sender: TObject);
begin
Self.Label1.Left := Self.Label1.Left - ;
if Self.Label1.Left + Self.Label1.Width = then
Self.Label1.Left := Form13.Width; end; end.
效果图: