To see it used in a more real application, try to look at this PIM sample.
You would usually use this control in a WTL view, so use the standard WTL AppWizard
to generate a project and derive from
CCalendarImpl instead of
CWindowImpl or whatever. Finally remember to chain the
control in the view's message map:
The control is also able to work as a subclassed
CHAIN_MSG_MAP( CCalendarImpl<CMyCalendarView> )
STATICcontrol on a dialog.
Weeknumbers are printed on the left side of the control. It turns out that weeknumber is one of those topics that quickly gets nasty and religous, because everyone has their own way of calculating weeknumbers. Luckily I stumbled over an implementation of the ISO standard, so it should be safe (I wish).
Custom drawing is supported by reflecting on the
in the owner window. The owner can custom draw each calendar cell.
Oh, and the control uses the MonthCalendar control for its month
selector component, so remember to
|GetCurSel||Retrieves the currently selected month.|
|SetCurSel||Sets the calendar month to display.|
|SetCalendarStyle||Changes the extended control styles.|
|DeleteAllItems||Removes all appointments from the view.|
|AddItem||Adds a new appointment.|
|GetItemCount||Returns the present number of appointments.|
|GetItem||Returns an appointment.|
|HitTest||Tests which day is located at the coordinates.|
|GetCalendarRange||Retrieves the range of days currently displayed in the entire calendar-view.|
|SetFont||Sets a new font.|
|SetTitle||Sets a new title.|
|SetBkColor||Sets the background color of the cells.|
|SetSelColor||Sets the color of the selected cell.|
|InvalidateCell||Repaint a particular day-cell.|
Source Code DependenciesMicrosoft Visual C++ 6.0
Microsoft WTL 3.1 Library
See AlsoThe Calendar and DayPlanner controls in action.
|Source Code (10 Kb)|