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