I see you writen you code in delphi..I show my component that i have writen myself
Here the code vor the component
-----------------------------------------------------------
unit CSTTimeDraw;
interface
uses
Windows, Messages, SysUtils, Classes,CSTBitmapLEDDigit;
type
TCSTTimeDraw = class(TComponent)
private
fSlider : TCSTBitmapSlider;
fHour,fMin,fSec,fMsec : TCSTBitmapLEDDigit;
/// front LEDS;
front_Hour,front_min,front_sec,front_msec : Integer;
back_hour , back_min,back_sec ,back_msec : Integer;
procedure DrawTimeFront;
procedure DrawTimeBack;
procedure TimeDecode(Time: Longint; var Hour, Min, Sec, MSec: Word);
{ Private-Deklarationen }
protected
{ Protected-Deklarationen }
public
{ Public-Deklarationen }
procedure DrawTime (back : Boolean);
procedure Execute;
published
property Slider : TCSTBitmapSlider read fslider write fslider;
property Hour : TCSTBitmapLEDDigit read fHour write fHour;
property Min : TCSTBitmapLEDDigit read fMin write fMin;
property Sec : TCSTBitmapLEDDigit read fSec write fSec;
property Msec : TCSTBitmapLEDDigit read fMsec write fMsec;
{ Published-Deklarationen }
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('CST-Tools', [TCSTTimeDraw]);
end;
procedure TimeDecode(Time: Longint; var Hour, Min, Sec, MSec: Word);
Var
MinCount, MSecCount: Word;
begin
if Time > 0 then
begin
DivMod32(Time, 60000, MinCount, MSecCount);
DivMod32(MinCount, 60, Hour, Min);
DivMod32(MSecCount, 1000, Sec, MSec);
end
else
begin
Hour := 0;
Min := 0;
Sec := 0;
MSec := 0;
end;
end;procedure TCSTTimeDraw.DrawTimeFront;
Var
nHour, nMin, nSec, nMSec: Word;
begin
TimeDecode(fslider.Position,nHour,nMin,nSec,nMsec);
front_Hour := nHour;
front_min := nMin;
front_sec := nsec;
front_msec := nmsec;
end;
procedure TCSTTimeDraw.DrawTimeBack;
Var
nHour, nMin, nSec, nMSec: Word;
begin
Timedecode (fSlider.MaxValue - fSlider.Position,nHour,nMin,nSec,nMsec);
back_Hour := nHour;
back_min := nMin;
back_sec := nsec;
back_msec := nmsec;
end;
procedure TCSTTimeDraw.DrawTime (back : Boolean);
begin
If back = false then begin
fmsec.Value := front_msec;
fsec.Value := front_sec;
fmin.Value := front_min;
fhour.Value := front_hour;
end
else
If back = true then begin
fmsec.Value := back_msec;
fsec.Value := back_sec;
fmin.Value := back_min;
fhour.Value := back_hour;
end;
end;
procedure TCSTTimeDraw.Execute;
begin
DrawTimeFront;
DrawTimeBack;
end;
end.
----------------------------------------------------------
In the Application self
procedure TForm_Raum_1.pos_timer_1Timer(Sender: TObject);
begin
if not Seeking_1 then pos_slider_1.Position := player1.Position;
TimeDraw_1.Execute;
SetRichtung(TimeDraw1,Image1);
end;
procedure SetRichtung (TimeDraw:TCSTTimeDraw;Image:TLabel);
begin
If Image.Caption = 'Remained' then
TimeDraw.DrawTime(false)
else
If Image.Caption = 'Elapsed' then
TimeDraw.DrawTime(true);
end;
Greets Chris