Using WTL and Graphics,I rewrite an list view tool,like:
,but after click the Name or Phone Number header to sort, it appears like:
.
Seems that the old one still there, but not so clear,whats wrong?
The Core Draw Code:
void _DrawItem(HDC hDC, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
...
CDCHandle dcx;
Gdiplus::Graphics grap(hDC);
CRect rcTmp;
GetClientRect(&rcTmp);
dcx.Attach(hDC);
BOOL bBackColor = TRUE;
if ((lpDrawItemStruct->itemID % 2) == 0)
{
bBackColor = FALSE;
}
Gdiplus::SolidBrush mySolidBrush(Gdiplus::Color(235, 235, 235,235));
if (pItem->getOver() || pItem->getChecked())
{
mySolidBrush.SetColor(Gdiplus::Color(215, 0, 0, 215));
}else{
if (bBackColor)
{
mySolidBrush.SetColor(Gdiplus::Color(235, 235, 235, 235));
}else{
mySolidBrush.SetColor(Gdiplus::Color(255, 255, 255, 255));
}
}
grap.FillRectangle(&mySolidBrush, lpDrawItemStruct->rcItem.left , lpDrawItemStruct->rcItem.top, nColumWidth,
lpDrawItemStruct->rcItem.bottom - lpDrawItemStruct->rcItem.top);
Just a guess but your alpha transparency value is not opaque so filling the rect with 235,235,235,235 will blend with the old content. Probably need a 255 in there for alpha.