
Değişik Bir Saat Uygulaması
-
- Üye
- Mesajlar: 62
- Kayıt: 18 Eyl 2011 02:31
Değişik Bir Saat Uygulaması
Arkadaşlar can sıkıntısından değişik bir saat uygulaması yaptım. kaynak dosyalarınıda gönderiyorum işine yarayan olursa geliştirebilir. Devexpress component yüklü olması gerekir.


- Dosya ekleri
-
- digi_saat.rar
- (46.25 KiB) 205 kere indirildi
Re: Değişik Bir Saat Uygulaması
Güzel bir çalışma..
Sadece matematiksel fonksiyonlar ile daha kısa kod yükü ile halledilebilir olduğuna bir örnek ile destek vereyim.
Yukarıdan aşağıya Label'lar

veya Matematikle işim olmaz derseniz, String operasyonlar ile olan hali..
Sadece matematiksel fonksiyonlar ile daha kısa kod yükü ile halledilebilir olduğuna bir örnek ile destek vereyim.
Yukarıdan aşağıya Label'lar


Kod: Tümünü seç
Uses DateUtils;
procedure TForm1.FormCreate(Sender: TObject);
Var
i : Integer;
begin
// 01..03 Saat Onlar Hanesi
// 04..13 Saat Birler Hanesi
// 14..23 Dakika Onlar Hanesi
// 24..33 Dakika Birler Hanesi
// 34..39 Saniye Onlar Hanesi
// 40..49 Saniye Birler Hanesi
for i := 1 to 49 do
case i of
01..03: TLabel(Self.FindComponent('label' + IntToStr(i))).Caption := IntToStr(i-01);
04..13: TLabel(Self.FindComponent('label' + IntToStr(i))).Caption := IntToStr(i-04);
14..23: TLabel(Self.FindComponent('label' + IntToStr(i))).Caption := IntToStr(i-14);
24..33: TLabel(Self.FindComponent('label' + IntToStr(i))).Caption := IntToStr(i-24);
34..39: TLabel(Self.FindComponent('label' + IntToStr(i))).Caption := IntToStr(i-34);
40..49: TLabel(Self.FindComponent('label' + IntToStr(i))).Caption := IntToStr(i-40);
end;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
Var
i : Integer;
s : TTime;
begin
// 01..03 Saat Onlar Hanesi
// 04..13 Saat Birler Hanesi
// 14..23 Dakika Onlar Hanesi
// 24..33 Dakika Birler Hanesi
// 34..39 Saniye Onlar Hanesi
// 40..49 Saniye Birler Hanesi
for i := 1 to 49
do TLabel(Self.FindComponent('label' + IntToStr(i))).Font.Style := [];
s := Time();
Caption := TimeToStr(s);
// Örneğin 22:01:15
i := HourOf(s) div 10; // 2
TLabel(Self.FindComponent('label' + IntToStr(i+01))).Font.Style := [fsBold];
i := HourOf(s) - ( (HourOf(s) div 10)*10 ); // 2
TLabel(Self.FindComponent('label' + IntToStr(i+04))).Font.Style := [fsBold];
i := MinuteOf(s) div 10; //0
TLabel(Self.FindComponent('label' + IntToStr(i+14))).Font.Style := [fsBold];
i := MinuteOf(s) - ( (MinuteOf(s) div 10)*10 ); // 1
TLabel(Self.FindComponent('label' + IntToStr(i+24))).Font.Style := [fsBold];
i := SecondOf(s) div 10; //1
TLabel(Self.FindComponent('label' + IntToStr(i+34))).Font.Style := [fsBold];
i := SecondOf(s) - ( (SecondOf(s) div 10)*10 ); // 5
TLabel(Self.FindComponent('label' + IntToStr(i+40))).Font.Style := [fsBold];
end;
Kod: Tümünü seç
procedure TForm1.Timer1Timer(Sender: TObject);
Var
i : Integer;
s : TTime;
begin
// 01..03 Saat Onlar Hanesi
// 04..13 Saat Birler Hanesi
// 14..23 Dakika Onlar Hanesi
// 24..33 Dakika Birler Hanesi
// 34..39 Saniye Onlar Hanesi
// 40..49 Saniye Birler Hanesi
for i := 1 to 49
do TLabel(Self.FindComponent('label' + IntToStr(i))).Font.Style := [];
s := Time();
Caption := TimeToStr(s);
// Örneğin 22:01:15
i := StrToInt(Copy(Caption, 1, 1)); // 2
TLabel(Self.FindComponent('label' + IntToStr(i+01))).Font.Style := [fsBold];
i := StrToInt(Copy(Caption, 2, 1)); // 2
TLabel(Self.FindComponent('label' + IntToStr(i+04))).Font.Style := [fsBold];
i := StrToInt(Copy(Caption, 4, 1)); //0
TLabel(Self.FindComponent('label' + IntToStr(i+14))).Font.Style := [fsBold];
i := StrToInt(Copy(Caption, 5, 1));; // 1
TLabel(Self.FindComponent('label' + IntToStr(i+24))).Font.Style := [fsBold];
i := StrToInt(Copy(Caption, 7, 1));; //1
TLabel(Self.FindComponent('label' + IntToStr(i+34))).Font.Style := [fsBold];
i := StrToInt(Copy(Caption, 8, 1));; // 5
TLabel(Self.FindComponent('label' + IntToStr(i+40))).Font.Style := [fsBold];
end;
-
- Üye
- Mesajlar: 62
- Kayıt: 18 Eyl 2011 02:31
Re: Değişik Bir Saat Uygulaması
Güzel yöntem tşk arkadaşım