destructor TRollText.Destroy;
begin
RollTimer.Free;
FFont.Free;
FLines.Free;
inherited Destroy;
end;
procedure TRollText.ApplyProperty;
begin
RollTimer.Interval:=FSpeed*500;
RollTimer.OnTimer:=OnTimer;
RollTimer.Enabled:=TRUE;
end;
procedure TRollText.Paint;
var
aline:string;
begin
case FRollDirection of
rdLeft://Left to Right
begin
aline:=FLines.Text;
aline:=Copy(aline,CurPos+1,Length(aline)-CurPos);
Canvas.Font:=FFont;
Canvas.TextOut(0,0,aline);
end;
end;
end;
procedure TRollText.OnTimer(Sender:TObject);
begin
case FRollDirection of
rdLeft://Left to Right
begin
CurPos:=CurPos+1;//CurPos作为左右移动的位置参数
if CurPos>=Length(FLines.Text) then
CurPos:=0;
end;
end;
end;