[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 dea602cd70)
This commit is contained in:
Giannis Adamopoulos 2017-11-10 20:59:25 +02:00 committed by Joachim Henze
parent 2e469036b3
commit 2534bc6542

View file

@ -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);