Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Possible to color days in MonthCal?


  • Please log in to reply
2 replies to this topic
epaga
  • Guests
  • Last active:
  • Joined: --
Is there any way to color individual days in the MonthCal control? Or should I use a "third-party" calendar script for something like that?

epaga
  • Guests
  • Last active:
  • Joined: --
in case anyone stumbles upon this in the future, here is the script i found here.

monthNb := 3   ; How many months are displayed. Can be fetched with MCM_GETMONTHRANGE
MCM_FIRST := 0x1000
MCM_SETDAYSTATE := MCM_FIRST + 8

; MCS_DAYSTATE = 1
Gui, Add, MonthCal, +0x1 vMyCalendar gBoldify
Gui, Add, Button, gBoldify w100, B
Gui Show

Gui +LastFound
guiID := WinExist()
ControlGet mcID, Hwnd, , SysMonthCal321, ahk_id %guiID%

Gosub Boldify
Return

Boldify:
VarSetCapacity(daysBuffer, 4 * monthNb, 0)
if bOdd
{
   days = 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31
}
else
{
   days = 2,4,6,8,10,12,14,16,18,20,22,24,26,28,30
}
bOdd := not bOdd
addr := &daysBuffer + 4
Loop Parse, days, `,
{
   o1 := (A_LoopField - 1) / 8
   o2 := Mod(A_LoopField - 1, 8)
   val := *(addr + o1) | (1 << o2)
   DllCall("RtlFillMemory", "UInt", addr + o1, "UInt", 1, "UChar", val)
}
Gosub SetDayState
Return

SetDayState:
   SendMessage MCM_SETDAYSTATE, monthNb, &daysBuffer, , ahk_id %mcID%
Return

GuiClose:
GuiEscape:
ExitApp


N4m33b
  • Members
  • 11 posts
  • Last active: Mar 14 2010 09:44 PM
  • Joined: 29 Jun 2007
hey, i was trying that code out, but im having a really hard time finding a way to bold a particular date, like 10 of february. i dont understand which part of that code specifies the month in question. maybe im pushing my luck but can someone give me on example of working gui with MonthCal with only 10th of february bolded?
pretty please? :p