Day Planner control

Day Planner control

This article was submitted .

The WTL Day Planner control is the second control part of my PIM controls. Together with my Calendar control they can form the basics of any good PIM (Personal Information Management) application.

The Day Planner manages a number of appointments and displays them in a day calendar fashion. The control can be tweaked to display 1 day only to several days at a time. The appointments are displayed in such a way that it's easy to see when they're scheduled for the current day.

By hovering over an appointment with the mouse, a ToolTip is displayed with the complete appointment description. And when they are clicked or double-clicked, the control responds by sending notifications to the owner window.
Drag'n'drop is supported within the view, so appointments can be dragged around and their scheduling time gets updated.
A number of style flags determine how the control is drawn. Several of the UI components (such as the day-text header) can be turned off, as well as the ability to customize how appointments are positioned and managed.
The control supports custom drawing by sending out WM_DRAWITEM notifications whenever it needs to paint an appointment. The owner window may catch these messages and do the painting instead.

The Sample

This sample demonstrates the beginning of a PIM application. It's not complete and currently doesn't allow you to manually edit the information in each appointment.
The sample does however demonstrate how to persist appointments (it loads and saves from an XML file), and acts as an example on how to operate the two controls.


GetCurSelRetrieves the currently selected date.
SetCurSelSets the date to display.
GetSelectedIndexRetrieves the index of the currently selected appointment.
SetDayPlannerStyleChanges the extended control styles.
DeleteAllItemsRemoves all appointments from the view.
AddItemAdds a new appointment.
GetItemCountReturns the present number of appointments.
GetItemReturns an appointment.
SetImageListAssigns an ImageList.
SetTextFontSets the font for the appointment text.
SetDayRangeConfigures how many days are displayed.
SetIntervalMinute interval to display for every hour.
SetWorkingHoursSets current working hours for display.
HitTestTests which day or appointment is located at the coordinates.
SetTopIndexScroll a specific hour into view.
SetItemMinSizeSets the minimum appointment height.
GetCalendarRangeRetrieves the range of days currently displayed in the view.

Source Code Dependencies

Microsoft Visual C++ 6.0
Microsoft WTL 3.1 Library

See Also

The Calendar control

Download Files

DownloadSource Code (89 Kb)

To the top