unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
Label1: TLabel;
Button1: TButton;
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
cTexto: String;
nLargoMarq: Integer;
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i: Byte;
nLarTexto: Byte;
begin
cTexto := 'Hola Mundo';
nLargoMarq := 50;
nLarTexto := Length(cTexto);
for i := 1 to nLargoMarq - nLarTexto do
Insert(' ', cTexto, 0);
Label1.Caption := cTexto;
Timer1.Interval := 100;
Timer1.Enabled := True;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
cChar: String[1];
begin
cChar := copy(cTexto, 1, 1);
Delete(cTexto, 1, 1);
cTexto := cTexto + cChar;
Label1.Caption := cTexto;
Label1.RePaint;
end;
end.