Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - Holydays
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Holydays

 Post Reply Post Reply
Author
Message
zaksoft View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 June 2003
Location: Italy
Status: Offline
Points: 162
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaksoft Quote  Post ReplyReply Direct Link To This Post Topic: Holydays
    Posted: 05 April 2009 at 6:24am
All views change colors accordingly to working days specs. But how can I tell that a specif date is to be considered not working even if the day a working day (ie Xmas or monday after Easter) ? It is possible also the opposite (in Italy shops are normally open the sunday before XMas) ?
 
TIA.
 
VS2022 - MFC MBCS Statically linked

XTP 23.1 Static Link

---------------------------------------------------------

Davide Zaccanti - ZakSoft - www.zaksoft.com

Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 08 April 2009 at 4:21pm
You can use BeforeDrawThemeObject notification and some code like this
 
void CCalendarDemoView::OnBeforeDrawThemeObject(XTP_NOTIFY_CODE Event, WPARAM wParam , LPARAM lParam)

{

ASSERT(Event == XTP_NC_CALENDAR_BEFORE_DRAW_THEMEOBJECT);

if (Event != XTP_NC_CALENDAR_BEFORE_DRAW_THEMEOBJECT)

return;

CXTPCalendarThemeOffice2007* pTheme2007 = DYNAMIC_DOWNCAST(CXTPCalendarThemeOffice2007, GetCalendarCtrl().GetTheme());

ASSERT(pTheme2007);

if (!pTheme2007)

return;

static CFont s_fntStriked;

if (s_fntStriked.m_hObject == NULL)

{

LOGFONT lfIcon;

VERIFY(::SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(lfIcon), &lfIcon, 0));

lfIcon.lfWeight = FW_BOLD;

lfIcon.lfHeight = 80;

lfIcon.lfStrikeOut = 1;

s_fntStriked.CreateFontIndirect(&lfIcon);

}

if (wParam == xtpCalendarBeforeDraw_DayViewEvent)

{

CXTPCalendarDayViewEvent* pViewEvent = (CXTPCalendarDayViewEvent*)lParam;

if (pViewEvent && pViewEvent->GetEvent()->GetSubject().Left(1) == _T("*"))

{

pTheme2007->GetDayViewPartX()->GetDayPartX()->GetGroupPartX()->GetSingleDayEventPartX()->m_fcsetNormal.fcsetSubject.fntFont.SetCustomValue(&s_fntStriked);

pTheme2007->GetDayViewPartX()->GetDayPartX()->GetGroupPartX()->GetMultiDayEventPartX()->m_fcsetNormal.fcsetSubject.fntFont.SetCustomValue(&s_fntStriked);

pTheme2007->GetDayViewPartX()->GetDayPartX()->GetGroupPartX()->GetSingleDayEventPartX()->m_fcsetSelected.fcsetSubject.fntFont.SetCustomValue(&s_fntStriked);

pTheme2007->GetDayViewPartX()->GetDayPartX()->GetGroupPartX()->GetMultiDayEventPartX()->m_fcsetSelected.fcsetSubject.fntFont.SetCustomValue(&s_fntStriked);

}

}

if (wParam == xtpCalendarBeforeDraw_MonthViewDay)

{

CXTPCalendarMonthViewDay* pDay = (CXTPCalendarMonthViewDay*)lParam;

if (pDay->GetDayDate().GetDayOfWeek() == 3)  == make your weekend case!

{

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);

//pTheme2007->GetMonthViewPartX()->GetDayPartX()->GetHeaderPartX()->

}

}

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.