type
TForm1 =
class(TForm)
PaintBox1: TPainBox;
PaintBox2: TPainBox;
private
FLabel1, FLabel2:
String;
procedure PaintBox1Paint(Sender: TObject);
procedure PaintBox2Paint(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
protected
procedure DoPaintBoxPaint(Sender: TObject;
const Text:
String; Erase: Boolean);
end;
procedure TForm1.DoPaintBoxPaint(Sender: TObject;
const Text:
String; Erase: Boolean);
var
R: TRect;
begin
with (Sender
as TPaintBox), Canvas
do
begin
R := ClientRect;
if Erase
then FillRect(R);
SetBkMode(
Handle, Transparent);
DrawText(
Handle, PChar(Text), Length(Text), @R, dt_Left
or dt_SingleLine
or dt_VCenter);
end;
end;
procedure TForm1.PaintBox1Paint(Sender: TObject);
begin
DoPaintBoxPaint(Sender, FLabel1, True);
end;
procedure TForm1.PaintBox2Paint(Sender: TObject);
begin
DoPaintBoxPaint(Sender, FLabel2, True);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
FLabel1 := FLabel1 + ....;
DoPaintBoxPaint(PaintBox1, FLabel1, False);
if Bumsda
then
DoPaintBoxPaint(PaintBox2, FLabel2, False);
end;