CListCtrl - 2
-
Hi, Am using an owner drawn list control, and I handle the WM_MEASUREITEM message to set the item height. Problem is, this message is sent only when a window is created (or so the MSDN documentation says). I'd like to set the item height, in response to user button clicks (to provide for the effect of zooming items)-this would let the user increase or decrease item heights by clicking buttons. Problem is, as noted earlier, the message is sent only when the list control is created-how do I set the item height, without destroying and creating the control again? Any help is much appreciated. --Shanker. "When it's done" - 3D Realms.
-
Hi, Am using an owner drawn list control, and I handle the WM_MEASUREITEM message to set the item height. Problem is, this message is sent only when a window is created (or so the MSDN documentation says). I'd like to set the item height, in response to user button clicks (to provide for the effect of zooming items)-this would let the user increase or decrease item heights by clicking buttons. Problem is, as noted earlier, the message is sent only when the list control is created-how do I set the item height, without destroying and creating the control again? Any help is much appreciated. --Shanker. "When it's done" - 3D Realms.
The fact that there is no way to set an item's RECT and that ListViews only supports LVS_OWNERDRAWFIXED leads me to believe that you are, unfortunately, out of luck... Unless, you only have one column in the ListView in question, then might I recommend moving to a ListBox instead... its WM_MEASUREITEM suffers the same problem ( only ever getting called once ), but you can set an items RECT at runtime ( like when the user clicks on it ).
void CMyZoomListBox::OnSelchange()
{
if ( -1 != m_nLastSelection ) {SetItemHeight ( m\_nLastSelection, m\_nNormalSize ); } m\_nLastSelection = GetCurSel (); SetItemHeight ( m\_nLastSelection, m\_nZoomSize ); Invalidate (); // update window to reflect size changes
}
Ben Burnett --------- On the topic of code with no error handling -- It's not poor coding, it's "optimistic" ;)