Salut à tous me revoilà pour un nouveau défi.
Voilà mon pgm :
Ca c'est ma dernière modification car avant il tourné tout aussi bien mais j'ai essayé autre chose (celui là quoi) et cela marche.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63 procedure TForm1.Timer3Timer(Sender: TObject); var c, e : integer; begin randomize; offset:=+1; ProgressBar3.Min:=0; ProgressBar3.Max:=10000; Timer3.Interval:=50; c:=ProgressBar3.Position + random(250) + 1; ProgressBar3.Position :=c; CurrentTime:=IncMillisecond(currentTime, Timer3.Interval); Label3.Caption:=FormatDateTime('ss:zzz', CurrentTime); e:=ProgressBar3.Position + offset; If ProgressBar3.Position = ProgressBar3.Max then Timer3.Enabled :=False; end; procedure TForm1.Timer1Timer(Sender: TObject); var a, c : integer; begin randomize; offset:=+1; ProgressBar1.Min:=0; ProgressBar1.Max:=10000; Timer1.Interval:=50; a:=ProgressBar1.Position + random(250) + 1; ProgressBar1.Position :=a; CurrentTime:=IncMillisecond(currentTime, Timer1.Interval); Label1.Caption:=FormatDateTime('ss:zzz', CurrentTime); c:=ProgressBar1.Position + offset; If ProgressBar1.Position = ProgressBar1.Max then Timer1.Enabled :=False; end; procedure TForm1.Timer2Timer(Sender: TObject); var b, d : integer; begin randomize; offset:=+1; ProgressBar2.Min:=0; ProgressBar2.Max:=10000; Timer2.Interval:=50; b:=ProgressBar2.Position + random(250) + 1; ProgressBar2.Position :=b; CurrentTime:=IncMillisecond(currentTime, Timer2.Interval); Label2.Caption:=FormatDateTime('ss:zzz', CurrentTime); d:=ProgressBar2.Position + offset; If ProgressBar2.Position = ProgressBar2.Max then Timer2.Enabled :=False; end;
Donc j'explique le truc j'ai trois ProgressBar 3 Labels et 3 Timer. A la compilation j'ai mes trois ProgressBar qui se lance ainsi que les timer qui m'affiche le temps dans les Labels. mon but serait de créer un Memo pour m'afficher le temps du vainqueur puis du second puis du troisième.
Or je ne sais comment m'y prendre j'ai essayé avec des comparaisons mais...
Donc si vous aviez une idée je vous en remercierait.
P.S : Mais trois ProgressBar, comme vous pouvez le constaté sont identiques (niveau du code) mais je trouve que les écarts de temps final sont faibles à chasue fois et sont tout le temps les même (5/100 de secondes) toujours la 1 puis la 2 puis la 3 qui gagne. Une idée à ce sujet? Merci d'avance++.
Partager