Einzelnen Beitrag anzeigen

nahpets
(Gast)

n/a Beiträge
 
#9

AW: Eigener Kalender bauen

  Alt 3. Sep 2016, 13:49
Naja, Datum ist 'ne Zahl, ginge also z. B. in 'ner For-Schleife:
Delphi-Quellcode:
procedure ProcessOneDay(ADate: TDate; var ADateLabel: TLabel; var ADayLabel: TLabel; var ACountLabel: TLabel; var AFeld: TPanel??);
begin
  Case DayOfWeek(ADate) of
    1 : ADayLabel.Caption := 'Mo';
    2 : ADayLabel.Caption := 'Di';
    3 : ADayLabel.Caption := 'Mi';
    4 : ADayLabel.Caption := 'Do';
    5 : ADayLabel.Caption := 'Fr';
    6 : begin
          ADayLabel.Caption := 'Sa';
          ADateLabel.Font.Style := [fsBold];
          ADayLabel.Font.Style := [fsBold];
          AFeld.Color := clWebBISQUE
        end;
    7 : begin
          ADayLabel.Caption := 'So';
          ADateLabel.Font.Style := [fsBold];
          ADayLabel.Font.Style := [fsBold];
          AFeld.Color := clWebBISQUE
        end;
  end;
  if (EmptyStr <> Feiertage.IstFeiertag(ADate)) then begin
    ADateLabel.Font.Style := [fsBold];
    ADayLabel.Font.Style := [fsBold];
    AFeld.Color := clWebBISQUE;
    ADateLabel.Font.Color := clRed;
    ADayLabel.Font.Color := clRed;
    ACountLabel.Left := 50;
    ACountLabel.Width := 55;
    ACountLabel.Alignment := taLeftJustify;
    ACountLabel.Font.Color := clRed;
    ACountLabel.Font.Size := 7;
    ACountLabel.Top := 1;
    ACountLabel.Caption := Feiertage.IstFeiertag(ADate);
  end;
  if Feiertage.IstFerientag(ADate) then begin
    AFeld.Color := clYellow;
  end;
end;

var
      i : Integer;
begin
  For i := Trunc(StrToDate('01.01.2016')) to Trunc(StrToDate('31.12.2016')) do begin
    ProcessOneDay(i, DateLabel, DayLabel, CountLabel, Feld);
  end;
end;
  Mit Zitat antworten Zitat