You can do this for Office 2007 theme only. It has extra customization features. CalendarThemeOffice2007
object has many parameters like fonts, colors, sizes, etc for each
Calendar object (like days, events, headers ...) Changing these parameters is applied to all objects of such type. The general idea of dynamic customization that calendar send special notification XTP_NC_CALENDAR_BEFORE_DRAW_THEMEOBJECT which allows you to change drawing parameters for each object separately. For how to use calendar notifications see: CCalendarDemoView::CCalendarDemoView() For optimization, this notification is sent only for objects which specified in BeforeDrawFlags member. When you set theme, make the following call: pTheme2007->SetBeforeDrawFlags(xtpCalendarBeforeDraw_MonthViewDay); See also: XTPCalendarBeforeDrawThemeObject enum.
Example of code to set day background color:
void CCalendarDemoView::OnBeforeDrawThemeObject(XTP_NOTIFY_CODE Event, WPARAM wParam , LPARAM lParam) { ASSERT(Event == XTP_NC_CALENDAR_BEFORE_DRAW_THEMEOBJECT); CXTPCalendarThemeOffice2007* pTheme2007 = DYNAMIC_DOWNCAST(CXTPCalendarThemeOffice2007, GetCalendarCtrl().GetTheme()); ASSERT(pTheme2007); if (!pTheme2007) return;
if (wParam == xtpCalendarBeforeDraw_MonthViewDay) { CXTPCalendarMonthViewDay* pDay = (CXTPCalendarMonthViewDay*)lParam; if (pDay->GetDayDate().GetDayOfWeek() == 3) { pTheme2007->GetMonthViewPartX()->GetDayPartX()->m_clrBackgroundDark = RGB(196, 128, 128); pTheme2007->GetMonthViewPartX()->GetDayPartX()->m_clrBackgroundLight = RGB(230, 128, 128); pTheme2007->GetMonthViewPartX()->GetDayPartX()->m_clrBackgroundSelected = RGB(128, 228, 228); } } } Code to advice notification: m_Sink.Advise(ptrCalendarConn, XTP_NC_CALENDAR_BEFORE_DRAW_THEMEOBJECT, &CCalendarDemoView::OnBeforeDrawThemeObject);
|
-- WBR, Serge
|