If i change the size of first column only (subitem check) to bigger size, the line height seems to be calculated by the later columns, so first columns looks cut. Any idea to force bigger cell height?
How to change item size and gap between them in custom drown CListCtrl
Posted by maggus
on 10/24/2008 03:28pm
As far as I know ON_WM_MEASUREITEM does not get called in Custom Drown list control. It is only called if control is Owner Drown.
So the question is how do you change items size and spacing between them in Custom Drown control?
Thanks for providing this article. UI code is difficult for me so it's always nice to learn from the experts. I made one observation and I could be wrong.
My code shown below adds the following line:
I added this line in both places that look for a different font. Am I correct in doing this or can there be problems? My code is working great, so thank you.
pDC = CDC::FromHandle(hdc);
m_pOldItemFont = pDC->SelectObject(pNewFont);
bNotifyPostPaint = TRUE;// need to restore font
I change font name for each item. But font Tahoma and Arial, for example, look differently. Text height may be greater then height of the item. This is no problem for me to change item height in ListView with OwnerDraw style. But I don't know, how to do this in ListView with CustomDraw style. I tried to do so:
In several cases pOldWnd in OnSetFocus()and probably pNewWnd in OnKillFocus() can point to non-window object.
Conditions pOldWnd!=NULL and pNewWnd!=NULL can not protect your code from debug assertion failure in GetParent(). I used the following:
if (pOldWnd && ::IsWindow(pOldWnd->m_hWnd) && pOldWnd->GetParent() == this)
if (pNewWnd && ::IsWindow(pNewWnd->m_hWnd) && pNewWnd->GetParent() == this)
I'm using ListCtrl's CustomDraw notification, and the
clrText & clrTextBk attributes to change text colors.
My code works well on Win98/Me but displays only
really few (only black & white) colors on Win2K,
whatever i set in theses attributes.
Do i have to create my ListCtrl with special styles ?