C++ 为什么重新绘制窗口后角色的阴影仍然存在?

C++ 为什么重新绘制窗口后角色的阴影仍然存在?,c++,listview,gdi+,gdi,wtl,C++,Listview,Gdi+,Gdi,Wtl,使用WTL和图形,我重写了一个列表视图工具,如: ,但单击要排序的姓名或电话号码标题后,它显示为: 看起来老的那个还在,但不太清楚,怎么了 核心绘图代码: void _DrawItem(HDC hDC, LPDRAWITEMSTRUCT lpDrawItemStruct) { ... CDCHandle dcx; Gdiplus::Graphics grap(hDC);

使用WTL和图形,我重写了一个列表视图工具,如: ,但单击要排序的姓名或电话号码标题后,它显示为:

看起来老的那个还在,但不太清楚,怎么了

核心绘图代码:

    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);

只是猜测一下,但是alpha透明度值不是不透明的,因此用235235235235填充rect将与旧内容混合。阿尔法可能需要255

@sounder:那么,如果你说“我试过了,但没有效果”,你为什么要接受这个答案??