万年历.rar
procedure TFRM_Date.DateChange(MyTime: TDateTime); var i, S: integer; StarNo: integer; Present: TDateTime; Year, Month, Day: Word; begin Label20.Caption := IntToStr(DateUtils.YearOf(Mytime)); Label17.Caption := IntToStr(DateUtils.MonthOf(Mytime)); Label16.Caption := Label17.Caption; Label1.Caption := IntToStr(DateUtils.YearOf(Mytime)); Label21.Caption := Copy(CnSkyStemOfYear(Mytime), 1, 2) + CnanimalOfYear(Mytime); lbl1.Caption := '选定日期为:'+DateToStr(Mytime); lbl2.Caption := Copy(CnSkyStemOfYear(Mytime), 1, 2) + Copy(CnanimalOfYear(Mytime),1,2)+'年'+CnMonthOfDate(Mytime)+CnDayOfDate(Mytime); lbl3.Caption := GetLunarHolDay(Mytime)+CnDayOfDateJr(Mytime)+Holiday(Mytime,DayOf(Mytime)); for i := 1 to 37 do begin CnDate[i].Visible := false; ChnDate[i].Visible := false; CnDate[i].Font.Size := 11; CnDate[i].Color := self.Color; ChnDate[i].Color := self.Color; if (((i) mod 7) = 0) or (((i) mod 7) = 1) then begin CnDate[i].Font.Color := clRed; ChnDate[i].Font.Color := clRed; end else begin CnDate[i].Font.Color := clBlack; ChnDate[i].Font.Color := Cnday.Font.Color; end; DecodeDate(MyTime, Year, Month, Day); Present := EncodeDate(Year, Month, 1); StarNo := dayofweek(Present); s := starno + DayOfMonth(Present) - 1; try for i := StarNo to s do begin Present := EncodeDate(Year, Month, i - StarNo + 1); CnDate[i].Caption := IntToStr(i - StarNo + 1); CnDate[i].Tag := i - StarNo + 1; ChnDate[i].Tag := CnDate[i].Tag; ChnDate[i].Caption := CnDayOfDate(Present); if ChnDate[i].Caption = '初一' then begin ChnDate[i].Caption := CnMonthOfDate(Present); ChnDate[i].Font.Color := clRed; end ; if length(Holiday(MyTime, i - StarNo + 1)) > 3 then begin ChnDate[i].Caption := Holiday(MyTime, i - StarNo + 1); ChnDate[i].Font.Color := $000080FF; end; if DateCn.GetLunarHolDay(Present) '' then begin ChnDate[i].Caption := GetLunarHolDay(Present); ChnDate[i].Font.Color := $00FF5353; end; if DateCn.CnDayOfDateJr(Present) '' then begin ChnDate[i].Caption := CnDayOfDateJr(Present); ChnDate[i].Font.Color := $000080FF; end; if i - StarNo + 1 = day then begin Shape2.Left := CnDate[i].left - 1; Shape2.Top := CnDate[i].top + 1; Label22.Caption := Constellation(Present, day); end; CnDate[i].Visible := true; ChnDate[i].Visible := true; end; except on EConvertError do begin exit; end else exit; end;
213.73KB
文件大小:
评论区