[COMCTL32] -Button: Implement drawing the image list with the BUTTON_IMAGELIST_ALIGN_...
authorGiannis Adamopoulos <gadamopoulos@reactos.org>
Fri, 10 Nov 2017 18:59:25 +0000 (20:59 +0200)
committerGiannis Adamopoulos <gadamopoulos@reactos.org>
Fri, 10 Nov 2017 18:59:25 +0000 (20:59 +0200)
dll/win32/comctl32/button.c

index ea250e8..a62ef6e 100644 (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);