如何改变ListBox的背景色?

解决方案 »

  1.   

    http://www.embhelp.com/bbs/dispbbs.asp?boardID=14&ID=219
      

  2.   

    响应OnCtlColor
    HBRUSH hbr = CFormView::OnCtlColor(pDC, pWnd, nCtlColor);

    // TODO: Change any attributes of the DC here
    switch(nCtlColor)
    {
    case CTLCOLOR_LISTBOX:
    pDC->SetBkMode(TRANSPARENT);
    hbr = (HBRUSH)m_brBack.GetSafeHandle();
    }   
    return hbr;m_brBack是你创建的画刷
      

  3.   

    重载OnEraseBkgnd
    BOOL CMyListBox::OnEraseBkgnd(CDC* pDC)
    {
    // TODO: 在此添加消息处理程序代码和/或调用默认值
    if(pDC){
    CRect rt;
    GetClientRect(&rt);
    pDC->FillRect(&rt,&CBrush(RGB(255,0,0)));
    }
    return TRUE;
    }
      

  4.   

    http://www.vckbase.com/document/viewdoc.asp?id=400