procedure TForm1.Timer1Timer(Sender: TObject); begin with Label4 do begin if StrToInt(Caption) in [0..3] then Font.Color := clRed else if StrToInt(Caption) in [4, 5] then Font.Color := clGreen; end end;
procedure TForm1.Timer1Timer(Sender: TObject); begin with Label4 do case StrToInt(Caption) of 0..3: Font.Color := clRed; 4, 5: Font.Color := clGreen; end; end;
procedure TForm1.Timer1Timer(Sender: TObject); begin with Label4 do begin if Caption[1] in ['0'..'3'] then Font.Color := clRed else if Caption[1] in ['4', '5'] then Font.Color := clGreen; end end;
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionconst CapMax = 5; Cap2Col : array[0..CapMax-1] integer = ( clRed, clRed, clRed, clGreen, clGreen ); procedure TForm2.Timer1Timer(Sender: TObject); begin with Label4 do begin Font.Color := Cap2Col[Tag]; Tag := (Tag + 1) mod CapMax; Caption := IntToStr(Tag); end; end;