Adds a special date at the end of the list of special dates.
C
int WINAPI SftDate_AddSpecialDate(HWND hwndCtl, LPCSFTDATE_SPECIALDATE lpSpecialDate);C++
int CSftDate::AddSpecialDate(LPCSFTDATE_SPECIALDATE lpSpecialDate); int CSftCalendar::AddSpecialDate(LPCSFTDATE_SPECIALDATE lpSpecialDate);
hwndCtl
The window handle of the month calendar control (SftCalendar), or of the date field control (SftDate) whose dropdown calendar is affected.
lpSpecialDate
A pointer to an SFTDATE_SPECIALDATE structure that describes the special date. Its cbSize member must be set to sizeof(SFTDATE_SPECIALDATE).
The return value is the zero-based index of the new special date, or -1 if the structure is not valid: cbSize is too small, recurrence is not one of the SFTDATE_RECURRENCE_xxx values or date is not a valid date.
The AddSpecialDate function adds a special date, a day the calendar shows differently, such as a holiday or an appointment. The SFTDATE_SPECIALDATE structure defines the date and its recurrence and how the day is shown: bold, colors, a picture, a tooltip and whether it can be selected.
The control copies the structure and the tooltip text. A picture (SFT_PICTURE) is not copied: the bitmap, icon, image list or GDI+ image it refers to must remain valid as long as the special date exists.
When several special dates apply to a day, the first one in the list is used. InsertSpecialDate adds a special date at a given position.
The application can change how any day is shown, special date or not, in the NM_SFTDATE_DAYFORMATTING notification.
Special dates apply to a month calendar control and to the dropdown calendar of a date field control.
days[4].colorFg = RGB(65, 105, 225);
Sft_SetPictureColorSample(&days[4].Picture, 6, 6, RGB(65, 105, 225), RGB(65, 105, 225));
days[4].lpszToolTip = TEXT("Team meeting");
for (i = 0; i < CONTROLS; ++i) {
SftDate_ClearSpecialDates(controls[i]);
if (fShow)
for (d = 0; d < 5; ++d)
SftDate_AddSpecialDate(controls[i], &days[d]);
}
}
static void SetColorScheme(HWND hwndCtl, BOOL fOn)
{
BOOL fDark = SftDate_IsDarkModeActive(hwndCtl);
int k;
days[4].colorFg = RGB(65, 105, 225);
Sft_SetPictureColorSample(&days[4].Picture, 6, 6, RGB(65, 105, 225), RGB(65, 105, 225));
days[4].lpszToolTip = _T("Team meeting");
for (int i = 0; i < CONTROLS; ++i) {
Control(i).ClearSpecialDates();
if (fShow)
for (int d = 0; d < 5; ++d)
Control(i).AddSpecialDate(&days[d]);
}
}
void CMainDlg::OnOption(UINT id)
{
int sel = 0;
BOOL fChecked = FALSE;See Also C/C++ API | Categories | Notifications