Defines how caller-supplied pixel dimensions (column widths, indentation, etc.) are interpreted relative to the current monitor DPI.
C
void WINAPI SftBox_SetPixelScaling(HWND hwndCtl, int mode); int WINAPI SftBox_GetPixelScaling(HWND hwndCtl);
C++
void CSftBox::SetPixelScaling(int mode); int CSftBox::GetPixelScaling() const;
hwndCtl
The window handle of the combo box control.
mode
Defines the pixel scaling mode. mode can be one of the following values:
| SFTBOX_PIXELSCALING_ASIS | Caller-supplied pixel dimensions are used verbatim, in physical screen pixels. This is the default. A column width of 100 is 100 screen pixels on any monitor. |
| SFTBOX_PIXELSCALING_STRETCH | Caller-supplied pixel dimensions are interpreted as 96-DPI reference pixels and are scaled by the factor currentDPI / 96 each time they are used. A column width of 100 is 100 screen pixels at 100%, 150 pixels at 150%, 200 pixels at 200%. The corresponding Get functions always return the value in caller-reference (96-DPI) units. |
GetPixelScaling returns a value indicating the current pixel scaling mode (SFTBOX_PIXELSCALING_ASIS or SFTBOX_PIXELSCALING_STRETCH).
The GetPixelScaling and SetPixelScaling functions define how caller-supplied pixel dimensions are interpreted relative to the current monitor DPI. The setting affects the following caller-supplied values:
SetPixelScaling is independent of SetImageScaling. SetPixelScaling controls how caller-supplied pixel dimensions are interpreted; SetImageScaling controls the size at which images are drawn. Either can be used without the other.
SFTBOX_PIXELSCALING_ASIS (the default) uses all pixel values as defined. A column width of 100 is 100 pixels on any monitor - useful when the application is already DPI-aware and performs its own scaling, but means the column appears physically smaller on high-DPI monitors.
SFTBOX_PIXELSCALING_STRETCH makes caller-supplied pixel values resolution-independent. Column widths, indentation and row header widths stay physically the same size as the user moves between monitors of different DPI. Because the corresponding Get functions always return caller-reference units, saved settings remain portable between machines of different DPI and between different monitors of the same machine.
A value other than SFTBOX_PIXELSCALING_ASIS or SFTBOX_PIXELSCALING_STRETCH is ignored.
The pixel scaling mode can also be defined using the pixelScaling member of the SFTBOX_CONTROL structure (see SetControlInfo). The current DPI used by the combo box control can be retrieved using GetDPI.
See Also C/C++ API | Categories | Notifications