Бегущая строка

Советы » Другое » Бегущая строка

Главная особенность данного вопроса - сделать бегущую строку, при движении которой надпись не моргала бы. Интервал для таймер - не меньше 50.


var


BitMap: TBitmap;
TW,X,Y: Integer;
Txt : String;

implementation



{$R *.DFM}

procedure

TForm1.FormCreate(Sender: TObject); begin


txt := 'Это бегущая строка.'; BitMap := TBitmap.Create; Bitmap.Width := Form1.Width; Bitmap.Height := 100;
Bitmap.Canvas.Brush.Color := clBlack; Bitmap.Canvas.Font.Name := 'Times New Roman'; Bitmap.Canvas.Font.Size := 35; Bitmap.Canvas.Font.Color := clWhite; TW := Bitmap.Canvas.TextWidth(txt); X := Form1.Width;
end

;

procedure

TForm1.Timer1Timer(Sender: TObject); begin


Bitmap.Width := Form1.Width; Bitmap.Height := Form1.Height; Bitmap.Canvas.Polygon([Point(0, 0), Point(799, 0), Point(799, 599), Point(0, 599)]); X := X - 3;
If X <= -TW then
X := Form1.Width;
Bitmap.Canvas.TextOut(X,10,txt); Form1.Canvas.Draw(0,0,Bitmap); end

;

Другое по теме:

Категории

Статьи

Советы

Copyright © 2023 - All Rights Reserved - www.delphirus.com