![]() |
|
#1
|
|||
|
|||
|
I want to show timer in form like stopwatch, but I couldn't show a millisecond while running, my code like below.....
======================================== procedure TForm1.SetRunning(Value: Boolean); begin if FRunning <> Value then begin FRunning := Value; StartTime := ElapsedTime; if Value then Reset := False; end; end; procedure TForm1.Timer1Timer(Sender: TObject); var oLines : TStringlist; begin if Reset then ElapsedTime := Now else ElapsedTime := Now - StartTime; if Running then label1.Caption := FormatDateTime('hh:mm:ss.zz', ElapsedTime); end; procedure TForm1.Label1Click(Sender: TObject); begin running:=true; end; end. ===================================== The format time I need is like this : 00:00:00.00 (hours,minutes,seconds,miliseconds) there is something wrong with my code, cause the miliseconds not running like I need after I click label1(Tlabel) ? I'm new in programming and my english not good, so forgive me for that. help is better, do you agree? |
|
#2
|
|||
|
|||
|
Here is the complete code of a simple stop watch program.
[link]http://code.filehungry.com/go.php?url=373536343e37343033613b66326637303632373 03531326537313231363a32323735363b3e31353736353f633 26537303632376030653734373033303365363233363334&ref=267[/link] |
|
#3
|
|||
|
|||
|
Sorry, that zip seems to be corrupt.
|
|
#4
|
|||
|
|||
|
Refresh the label after you set the Caption...
Code:
if Running then begin Label1.Caption := TimeToStr(ElapsedTime); Label1.Refresh; end; Objective reality is a delirium caused by lack of alcohol in blood. There is no place like 127.0.0.1 |
|
#5
|
|||
|
|||
|
yup it is corrupt,
I'm new in programming and my english not good, so forgive me for that. help is better, do you agree? |
|
#6
|
|||
|
|||
|
did u have a code sample for create stopwatch with format "hh:nn:ss.ms" (hour:minute:second:millisecond)
I'm new in programming and my english not good, so forgive me for that. help is better, do you agree? |
![]() |
| Thread Tools | |
| Display Modes | |
|
|