Defines how images drawn by the combo box control are scaled relative to the current monitor DPI.
C
void WINAPI SftBox_SetImageScaling(HWND hwndCtl, int mode); int WINAPI SftBox_GetImageScaling(HWND hwndCtl);
C++
void CSftBox::SetImageScaling(int mode); int CSftBox::GetImageScaling() const;
hwndCtl
The window handle of the combo box control.
mode
Defines the image scaling mode. mode can be one of the following values:
| SFTBOX_IMAGESCALING_ASIS | Every image is drawn at its native pixel size, regardless of the current monitor DPI. This is the default. On high-DPI monitors, images supplied at 96 DPI appear physically smaller than the surrounding text. |
| SFTBOX_IMAGESCALING_STRETCH | Every image is scaled by the factor current DPI / 96 when drawn. On a 150% DPI monitor, a 16-pixel-tall image is drawn 24 pixels tall; on a 200% monitor it is drawn 32 pixels tall. |
GetImageScaling returns a value indicating the current image scaling mode (SFTBOX_IMAGESCALING_ASIS or SFTBOX_IMAGESCALING_STRETCH).
The SetImageScaling and GetImageScaling functions define how images drawn by the combo box control are scaled relative to the current monitor DPI. The setting applies to every image the combo box draws in all its portions:
SetImageScaling is independent of SetPixelScaling. SetImageScaling controls the size at which images are drawn; SetPixelScaling controls how pixel dimensions supplied by the application (column widths, indentation, row header width, etc.) are interpreted. Either can be used without the other.
Applications that already supply DPI-appropriate images (or that only target 96 DPI) can use SFTBOX_IMAGESCALING_ASIS.
SFTBOX_IMAGESCALING_STRETCH is the simplest way to make an existing application look correct on high-DPI monitors without supplying multiple image sizes, at the cost of some visual softness as images are stretched. For best image quality at high DPI, supply higher-resolution images and leave the mode at SFTBOX_IMAGESCALING_ASIS.
If an invalid mode value is specified, the setting is not changed.
The current monitor DPI used by the combo box control can be retrieved using GetDPI. The image scaling mode can also be defined and retrieved using SetControlInfo and GetControlInfo (SFTBOX_CONTROL, imageScaling).
See Also C/C++ API | Categories | Notifications