- There is no LVS_OWNERDRAWVARIABLE style (does not exist) for CListView only LVS_OWNERDRAWFIXED style, therefore, MeasureItem will not be called for each added item.
- This is a problem if you are using an owner-drawn CListView and want to change font sizes during runtime.
- The only way to properly work-around this limitation is to override OnSetFont.
- Override OnSetFont to send a WM_WINDOWPOSCHANGED message.
- This will cause MeasureItem to be called every time you change fonts.
- Do whatever you want in MeasureItem, such as modify the MEASUREITEMSTRUCT to match the size of the current font.
LRESULT CMyListCtrl::OnSetFont( WPARAM wParam, LPARAM )
LRESULT res = Default();
GetWindowRect( &rc );
wp.hwnd = m_hWnd;
wp.cx = rc.Width();
wp.cy = rc.Height();
wp.flags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOOWNERZORDER | SWP_NOZORDER;
SendMessage( WM_WINDOWPOSCHANGED, 0, (LPARAM)&wp );
Changing row height in owner drawn control