HeaderPane
Main
Hide
Share Link
Print

GDI+

The SftDate and SftCalendar controls use GDI+ for features not otherwise available:

GDI+ ships with all supported Windows versions (Windows 10 and above).

Loading GDI+ Images

SftDate/DLL provides four functions which load and free GDI+ images, so the application does not have to initialize GDI+ or use GDI+ classes directly. Each load function returns an image pointer, which is used in a SFT_PICTURE structure of type SFT_PICTURE_GDIPLUS (see Sft_SetPictureGDIPlusImage).

FunctionDescription
SftDate_LoadGDIPlusImageFromResourceLoads an image from an application resource.
SftDate_LoadGDIPlusImageFromFileLoads an image from a file.
SftDate_FreeGDIPlusImageLoadedFromResourceFrees an image returned by SftDate_LoadGDIPlusImageFromResource.
SftDate_FreeGDIPlusImageLoadedFromFileFrees an image returned by SftDate_LoadGDIPlusImageFromFile.
LPVOID lpImage = SftDate_LoadGDIPlusImageFromResource(hInst, TEXT("PNG"), MAKEINTRESOURCE(IDR_MEETING));
SFTDATE_SPECIALDATE sd;
memset(&sd, 0, sizeof(sd));
sd.cbSize = sizeof(SFTDATE_SPECIALDATE);
GetLocalTime(&sd.date);
sd.recurrence = SFTDATE_RECURRENCE_WEEKLY;
sd.colorBg = sd.colorFg = SFTDATE_NOCOLOR;
sd.fEnabled = TRUE;
Sft_SetPictureGDIPlusImage(&sd.Picture, lpImage);
SftDate_AddSpecialDate(hwndCalendar, &sd);
. . .
SftDate_ClearSpecialDates(hwndCalendar);              /* the image is no longer used */
SftDate_FreeGDIPlusImageLoadedFromResource(lpImage);

The load function and the matching free function must always be paired. An image must not be freed while a control still uses it.


Last Updated 11/26/2026 - (email)
© 2026 Softel vdm, Inc.