CListCtrl and GetSubItemRect()
In the OnNMCustomDraw, GetSubItemRect() is being called on the first itme and rect.right is the full width of the control, not that of the column. Does anyone have any ideas why? I am calling it this way:
GetSubItemRect(nItem, nSubItem, LVIR_BOUNDS, rect);
[267 byte] By [
scarleton] at [2007-11-18 20:34:27]

# 1 Re: CListCtrl and GetSubItemRect()
Just curious . Are all the columns added when it is called the first time ? You could try adding code to getsubitemrect for all columns and see if each returns TRUE or FALSE.
My guess is inserting a column could trigger a draw. So, each time you insert a column, you may get a NMCUSTOMDRAW.
# 2 Re: CListCtrl and GetSubItemRect()
For the 1st item (column 0), it might depend on which stage you attempt to get the subitem rect:
switch( pCD->nmcd.dwDrawStage )
{
case CDDS_PREPAINT: // First stage (for the whole control)
{
// ...
*pResult = CDRF_NOTIFYITEMDRAW;
}
break;
case CDDS_ITEMPREPAINT:
{
// ...
*pResult = CDRF_NOTIFYSUBITEMDRAW;
}
break;
case CDDS_ITEMPREPAINT | CDDS_SUBITEM : // Stage three
{
//...
*pResult = CDRF_NOTIFYPOSTPAINT;
}
// .........
RCFox at 2007-11-11 1:13:15 >

# 3 Re: CListCtrl and GetSubItemRect()
I omitted some stages in my previous post. In case this helps.
case CDDS_ITEMPOSTPAINT|CDDS_SUBITEM: // Stage four
{
}
break;
case CDDS_ITEMPOSTPAINT:
{
//
}
break;
default:// it wasn't a notification that was interesting to us.
{
*pResult = CDRF_DODEFAULT;
break;
}
RCFox at 2007-11-11 1:14:14 >
