Zhiyi Zhang : comctl32/treeview: Support HiDPI for unthemed item check boxes.
Alexandre Julliard
julliard at winehq.org
Mon Feb 7 15:56:05 CST 2022
Module: wine
Branch: master
Commit: 35ed21d27aa23fb318a00a769b945f48193f23a5
URL: https://source.winehq.org/git/wine.git/?a=commit;h=35ed21d27aa23fb318a00a769b945f48193f23a5
Author: Zhiyi Zhang <zzhang at codeweavers.com>
Date: Mon Feb 7 16:09:45 2022 +0800
comctl32/treeview: Support HiDPI for unthemed item check boxes.
Signed-off-by: Zhiyi Zhang <zzhang at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/comctl32/treeview.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/dlls/comctl32/treeview.c b/dlls/comctl32/treeview.c
index 608ce489e33..e9e2cb37d47 100644
--- a/dlls/comctl32/treeview.c
+++ b/dlls/comctl32/treeview.c
@@ -3011,30 +3011,34 @@ static BOOL TREEVIEW_InitThemedCheckboxes(TREEVIEW_INFO *info)
static void
TREEVIEW_InitCheckboxes(TREEVIEW_INFO *infoPtr)
{
+ int nIndex, width, height;
RECT rc;
HBITMAP hbm, hbmOld;
HDC hdc, hdcScreen;
- int nIndex;
if (TREEVIEW_InitThemedCheckboxes(infoPtr))
return;
- infoPtr->himlState = ImageList_Create(16, 16, ILC_COLOR | ILC_MASK, 3, 0);
+ width = 12 * GetDpiForWindow(infoPtr->hwnd) / 96 + 1;
+ height = width;
+ infoPtr->himlState = ImageList_Create(width, height, ILC_COLOR | ILC_MASK, 3, 0);
hdcScreen = GetDC(0);
hdc = CreateCompatibleDC(hdcScreen);
- hbm = CreateCompatibleBitmap(hdcScreen, 48, 16);
+ hbm = CreateCompatibleBitmap(hdcScreen, width * 3, height);
hbmOld = SelectObject(hdc, hbm);
- SetRect(&rc, 0, 0, 48, 16);
+ SetRect(&rc, 0, 0, width * 3, height);
FillRect(hdc, &rc, (HBRUSH)(COLOR_WINDOW+1));
- SetRect(&rc, 18, 2, 30, 14);
+ rc.left = width;
+ rc.right = rc.left + width;
DrawFrameControl(hdc, &rc, DFC_BUTTON,
DFCS_BUTTONCHECK|DFCS_FLAT);
- SetRect(&rc, 34, 2, 46, 14);
+ rc.left = width * 2;
+ rc.right = rc.left + width;
DrawFrameControl(hdc, &rc, DFC_BUTTON,
DFCS_BUTTONCHECK|DFCS_FLAT|DFCS_CHECKED);
@@ -3047,8 +3051,8 @@ TREEVIEW_InitCheckboxes(TREEVIEW_INFO *infoPtr)
DeleteDC(hdc);
ReleaseDC(0, hdcScreen);
- infoPtr->stateImageWidth = 16;
- infoPtr->stateImageHeight = 16;
+ infoPtr->stateImageWidth = width;
+ infoPtr->stateImageHeight = height;
}
static void
More information about the wine-cvs
mailing list