//定时器事件 ->修改为以下语句
procedure TCnAAMarqueeText.OnTimer(Sender: TObject);
begin
if not FTimer.Enabled or not Visible then Exit;
if FScrollType = stRoundtrip then
begin
if FTimer.Tag = 0 then
Inc(FCurrentStep, FScrollStep)
else
Dec(FCurrentStep, FScrollStep);
if FCurrentStep > Width - FCaptionWidth then
begin
FCurrentStep := Width - FCaptionWidth;
FTimer.Tag := 1;
end
else if FCurrentStep < 0 then
begin
FCurrentStep := 0;
FTimer.Tag := 0;
end;
Paint;
end
else begin
Inc(FCurrentStep, FScrollStep);
Paint;
if FCurrentStep >= FCaptionWidth + Width then
FCurrentStep := 0;
end;
end;
//绘制画布 -> 修改为一下语句
procedure TCnAAMarqueeText.PaintCanvas;
var
R: TRect;
X, Y: Integer;
lpPaint: tagPAINTSTRUCT;
MemBmp: TBitmap;
begin
...
if FScrollType = stRightToLeft then
X := Width - FCurrentStep
else if FScrollType = stLeftToRight then
X := - Canvas.TextWidth(Caption) + FCurrentStep
else
X := FCurrentStep;
...
end;Author:
Passion Time: 2008-11-27 20:17