Defines how the pictures of days are scaled relative to the current monitor DPI.
C
int WINAPI SftDate_GetImageScaling(HWND hwndCtl); BOOL WINAPI SftDate_SetImageScaling(HWND hwndCtl, int mode);
C++
int CSftDate::GetImageScaling() const; int CSftCalendar::GetImageScaling() const; BOOL CSftDate::SetImageScaling(int mode); BOOL CSftCalendar::SetImageScaling(int mode);
hwndCtl
The window handle of the date field control (SftDate) or the month calendar control (SftCalendar).
mode
The scaling mode. mode can be one of the following values:
| SFTDATE_IMAGESCALING_ASIS | Pictures are drawn at their native pixel size. This is the default. |
| SFTDATE_IMAGESCALING_STRETCH | Pictures are scaled by the monitor DPI / 96. |
GetImageScaling returns the scaling mode, one of the values listed above.
SetImageScaling returns TRUE if mode is valid, otherwise FALSE.
The GetImageScaling and SetImageScaling functions define and retrieve how the pictures of special dates (SFTDATE_SPECIALDATE) and of days formatted in the NM_SFTDATE_DAYFORMATTING notification are scaled. A picture is never taller than half the height of its day.
SFTDATE_IMAGESCALING_STRETCH is the simplest way to make pictures look correct on high-DPI monitors, at the cost of some softness. For the best quality, supply higher-resolution images and keep SFTDATE_IMAGESCALING_ASIS. The current DPI is returned by GetDPI.
GetControls(hwndDlg, c);
hwndCal = c[FIELDS];
GetLocalTime(&now);
weekLater = AddDays(&now, 6);
for (i = 0; i < CONTROLS; ++i) {
SftDate_SetDarkMode(c[i], SFTDATE_DARKMODE_AUTO);
SftDate_SetHighContrastMode(c[i], SFTDATE_HIGHCONTRAST_AUTO);
SftDate_SetImageScaling(c[i], SFTDATE_IMAGESCALING_STRETCH);
SftDate_SetValue(c[i], &now);
}
SftDate_SetFormat(GetDlgItem(hwndDlg, IDC_LONGDATE), SFTDATE_FORMAT_LONGDATE);
SftDate_SetFormat(GetDlgItem(hwndDlg, IDC_TIMELIST), SFTDATE_FORMAT_SHORTTIME);
SftDate_SetTimeInterval(GetDlgItem(hwndDlg, IDC_TIMELIST), 15);
{
SYSTEMTIME now;
GetLocalTime(&now);
SYSTEMTIME weekLater = AddDays(now, 6);
for (int i = 0; i < CONTROLS; ++i) {
Control(i).SetDarkMode(SFTDATE_DARKMODE_AUTO);
Control(i).SetHighContrastMode(SFTDATE_HIGHCONTRAST_AUTO);
Control(i).SetImageScaling(SFTDATE_IMAGESCALING_STRETCH);
Control(i).SetValue(&now);
}
m_Fields[1].SetFormat(SFTDATE_FORMAT_LONGDATE);
m_Fields[2].SetFormat(SFTDATE_FORMAT_SHORTTIME);
m_Fields[2].SetTimeInterval(15);See Also C/C++ API | Categories | Notifications