When per-monitor DPI changes (WM_DPICHANGED
message), the built-in scrollbars of controls like list view, tree view, rich edit, listbox are not scaled (as expected).
They need to be scaled programmatically.
Though I didn't find any API (neither in Win32, let only in WinForms) to set scrollbar size.
What API can I use to set scrollbar size (width)?
Or at least how I do get hold of the scrollbar handle? (I assume that internally the scrollbars are separate child controls) Once I have the handle, I assume I can use MoveWindow
to resize it (Edit: my assumption was incorrect, as the answer by @Anders shows)
For a background, see High DPI Desktop Application Development on Windows.
There are couple seemingly duplicate questions, but none of them are actually relevant:
The answers there either change system-wide settings or work for DataGrid
only (that have separate child scrollbar controls available in its interface).
WM_DPICHANGED
to the child windows? What happens if you callSetWindowPos(SWP_FRAMECHANGED)
on the child windows? I don't know if either is the right answer, but these would be the first things I would try... (I need to re-read the MSDN pages on DPI awareness.) – andlabs