Ich habe deinen Code umgebaut und damit ist es möglich, für jedes Datum eine andere Farbe festzulegen. Du musst nur zusätzliche Abfragen eiinbauen, wann du eine andere Farbe haben möchtest:
Code: Alles auswählen
EnableExplicit
LoadFont(0, "Courier New", 10)
LoadFont(1, "Courier New", 10, #PB_Font_Bold)
Procedure showCalendarMonth()
Protected Date
Protected DrawTextX
Protected DrawTextY
Protected m
Protected x
Protected y
Protected d
Protected Month
Protected Year
Protected DayOfWeek
If StartDrawing(CanvasOutput(0))
For m=Month(Date()) To 12
DrawingFont(FontID(1))
DrawTextX = 30
DrawTextY + 20
DrawText(DrawTextX, DrawTextY, StringField("Januar,Februar,März,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember", m, ",") + " " + Year(Date()), RGB(0, 0, 0), RGB(255, 255, 255))
DrawTextX = 0
DrawTextY + 20
For d=1 To 7
DrawTextX + 30
DrawText(DrawTextX, DrawTextY, StringField("Mo,Di,Mi,Do,Fr,Sa,So", d, ","), RGB(0, 0, 0), RGB(255, 255, 255))
Next d
DrawingFont(FontID(0))
Date = Date(Year(Date()), m, 1, 0, 0, 0)
Month = Month(Date)
Year = Year(Date)
DayOfWeek = DayOfWeek(Date)-1
If DayOfWeek = -1
DayOfWeek = 6
EndIf
Date = AddDate(Date, #PB_Date_Day, -DayOfWeek)
DrawTextY + 20
For y=1 To 6
DrawTextX = 0
For x=1 To 7
DrawTextX + 30
DrawText(DrawTextX, DrawTextY, Str(Day(Date)), RGB(0, 0, 0), RGB(255, 255, 255))
Date = AddDate(Date, #PB_Date_Day, 1)
Next x
DrawTextY + 20
Next y
Next m
StopDrawing()
EndIf
EndProcedure
If OpenWindow(0, 0, 0, 250, 920, "Kalender", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0, 0, 0, 250, 920, #PB_Canvas_Border)
showCalendarMonth()
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow : EndIf