'Set Header Item Height winapi c++
I am trying to make a beautiful table and am using LVS_OWNERDRAWFIXED style to draw my own table design. So, I want to change the header item height of the table but can't do this. I am using the code below to change item height but its just changing item width. What am I doing wrong here, anyone know?
HDITEM hi = { 0 };
hi.mask = HDI_FORMAT | HDI_HEIGHT;
Header_GetItem(hHeader, i, &hi);
hi.fmt = HDF_OWNERDRAW;
hi.cxy = 70; // this always sets width instead of height
Header_SetItem(hHeader, i, &hi);
There is no much information about header resizing online, maybe someone knows what is the problem here?
Solution 1:[1]
I solved this problem myself. I got the list view header HWND and set SetWindowSubclass() on that, then in the subclass method I caught HDM_LAYOUT event and put there the code below:
case HDM_LAYOUT: {
LPHDLAYOUT pHL = reinterpret_cast<LPHDLAYOUT>(lParam);
RECT* pRect = pHL->prc;
WINDOWPOS* pWPos = pHL->pwpos;
int r = DefSubclassProc(hWnd, uMsg, wParam, lParam);
pWPos->cy = 50; // Header height
pRect->top = 50; // Header offset top
return r;
}
This all works perfect, thanks for your answers anyways.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Artrm Kovalchuk |
