procedure TSSText.TimerAction(Sender: TObject);
begin
if tx <= 0 - Canvas.TextHeight(FLines.Strings[0]) * FLines.Count
then
tx := height;
tx := tx - 1 - FSpeed;
Repaint;
end;
procedure TSSText.PaintText;
var
R,G,B,I: Integer;
txt:
String;
begin
if FLines.Count > 0
then
begin
Canvas.Brush.Style := bsClear;
for I := 0
to FLines.Count -1
do
begin
if tx + Canvas.TextHeight(FLines.Strings[I]) * I < 50
then
begin
R := Round(GetRValue(Color1) + ((GetRValue(Canvas.Font.Color) - GetRValue(Color1)) *
I / (50-1)));
G := Round(GetGValue(Color1) + ((GetGValue(Canvas.Font.Color) - GetGValue(Color1)) *
I / (50-1)));
B := Round(GetBValue(Color1) + ((GetBValue(Canvas.Font.Color) - GetBValue(Color1)) *
I / (50-1)));
Canvas.Font.Color :=
RGB(R,G,B);
end
else
Canvas.Font.Color := clFontOld;
Canvas.TextOut(10, tx + Canvas.TextHeight(FLines.Strings[0]) * I, FLines.Strings[I]);
end;
Canvas.Brush.Style := bsSolid;
end;
end;
procedure TSSText.Paint;
var
Rect: TRect;
R, G, B, I, Y: Integer;
begin
Width := Width;
Height := Height;
// Rechteck
Canvas.Brush.Color := ColorToRGB(FColor1);
Canvas.Rectangle(0,0,Width,height);
// übergabeparameter Rect bereitstellen,
// wenn Verlauf ausgewählt
if (FGradient <> grNone)
then
begin
Rect.Left := 0;
Rect.Top := 0;
Rect.Right := Width;
Rect.Bottom := height;
end;
// Verlauf herstellen
if (FGradient = grTopToBottom)
then
DrawGradientH(Canvas, FColor1, FColor2, Rect)
else if (FGradient = grLeftToRight)
then
DrawGradientV(Canvas, FColor1, FColor2, Rect);
PaintText;
// Rand Zeichnen
if (FBorder)
then
begin
Canvas.Pen.Color := ColorToRGB(FBorderColor);
Canvas.Brush.Style := bsClear;
Canvas.Rectangle(0,0,Width,height);
Canvas.Rectangle(width,0,Width,height);
end;
end;