There, found the reason that code doesn't work (LVIF_ICON was as tall as LVIF_BOUNDS) and fixed it (use the actual icon size for vertical centering)

This commit is contained in:
Pietro Gagliardi 2018-06-12 01:54:21 -04:00
parent 0f89418a95
commit 59d8e81b85
1 changed files with 3 additions and 6 deletions

View File

@ -144,7 +144,7 @@ HRESULT uiprivNM_CUSTOMDRAWImagesCheckboxes(uiTable *t, NMLVCUSTOMDRAW *nm, LRES
uiprivTableColumnParams *p;
int index;
RECT r;
RECT cellRect;
int cxIcon, cyIcon;
LONG yoff;
if (nm->nmcd.dwDrawStage == (CDDS_SUBITEM | CDDS_ITEMPREPAINT)) {
@ -169,14 +169,11 @@ HRESULT uiprivNM_CUSTOMDRAWImagesCheckboxes(uiTable *t, NMLVCUSTOMDRAW *nm, LRES
return E_FAIL;
}
// the real listview also does this :|
ZeroMemory(&cellRect, sizeof (RECT));
cellRect.left = LVIR_BOUNDS;
cellRect.top = nm->iSubItem;
if (SendMessageW(t->hwnd, LVM_GETSUBITEMRECT, nm->nmcd.dwItemSpec, (LPARAM) (&cellRect)) == 0) {
if (ImageList_GetIconSize(t->smallImages, &cxIcon, &cyIcon) == 0) {
logLastError(L"LVM_GETSUBITEMRECT cell");
return E_FAIL;
}
yoff = ((cellRect.bottom - cellRect.top) - (r.bottom - r.top)) / 2;
yoff = ((r.bottom - r.top) - cyIcon) / 2;
r.top += yoff;
r.bottom += yoff;
if ((nm->nmcd.dwItemSpec%2)==0)