From 2534bc65425cb07febdaafaca192d3e7dfa81c54 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Fri, 10 Nov 2017 20:59:25 +0200 Subject: [PATCH] [0.4.7] cherry-pick [COMCTL32] -Button: Implement drawing the image list with the BUTTON_IMAGELIST_ALIGN_CENTER parameter. This is enough to fix buttons with images created by Lazarus but only with themes. The non themed branch of the code is slightly more complex and will be fixed next. CORE-13170 (cherry picked from commit dea602cd7073d44d90d84fe6674eba6369f80d19) --- dll/win32/comctl32/button.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dll/win32/comctl32/button.c b/dll/win32/comctl32/button.c index ea250e84062..a62ef6e789c 100644 --- a/dll/win32/comctl32/button.c +++ b/dll/win32/comctl32/button.c @@ -420,16 +420,21 @@ BOOL BUTTON_DrawIml(HDC hDC, BUTTON_IMAGELIST *pimlData, RECT *prc, BOOL bOnlyCa } else if (pimlData->uAlign == BUTTON_IMAGELIST_ALIGN_TOP) { - left = prc->left + (prc->right - prc->left - ImageSize.cy) / 2; + left = prc->left + (prc->right - prc->left - ImageSize.cx) / 2; top = prc->top + pimlData->margin.top; prc->top = top + ImageSize.cy + pimlData->margin.bottom; } else if (pimlData->uAlign == BUTTON_IMAGELIST_ALIGN_BOTTOM) { - left = prc->left + (prc->right - prc->left - ImageSize.cy) / 2; + left = prc->left + (prc->right - prc->left - ImageSize.cx) / 2; top = prc->bottom - pimlData->margin.bottom - ImageSize.cy; prc->bottom = top - pimlData->margin.top; } + else if (pimlData->uAlign == BUTTON_IMAGELIST_ALIGN_CENTER) + { + left = prc->left + (prc->right - prc->left - ImageSize.cx) / 2; + top = prc->top + (prc->bottom - prc->top - ImageSize.cy) / 2; + } if (!bOnlyCalc) ImageList_Draw(pimlData->himl, 0, hDC, left, top, 0);