treeview如何改变其背景颜色呀?我在onerasebkcolor中用fillsolidrect填充颜色,其背景色是改变了,可是添加的树的各项的背景色还是白色的,如何都改变成同一种颜色呀

解决方案 »

  1.   

    我用的是vc5.0,好像vc6.0下有下面两个函数就可以实现,但是vc5.0下如何实现相应的功能呀?
    treeCtrl.SetTextColor(RGB(0,0,255));
    treeCtrl.SetBkColor(RGB(207,226,248));
      

  2.   

    vc5.0下没有setbkcolor和settextcolor这两个函数呀?
      

  3.   

    背景色:SetBkColor(),前景色也就是你的文本的颜色:SetTextColor(),
      

  4.   

    ////
    Sets the background color of the control. You can send this message explicitly or by using the TreeView_SetBkColor macro. TVM_SETBKCOLOR
        wParam = 0;
        lParam = (LPARAM)(COLORREF) clrBk;Requirements 
      Version 4.71 and later of Comctl32.dll
    ///
    试一下这两句
      SendMessage(m_clrtree.GetSafeHwnd(),TVM_SETBKCOLOR,0,(LPARAM)RGB(0,255,0));
      SendMessage(m_clrtree.GetSafeHwnd(),TVM_SETTEXTCOLOR,0,(LPARAM)RGB(0,0,255));
      

  5.   

    覆盖基类的DrawItem函数。用其中用CDC dc = CDC::FromHandle(lpDrawItemStruct->hDC);
    dc.SetTextColor和dc.SetBkColor.
      

  6.   

    如TVM_SETBKCOLOR,TVM_SETTEXTCOLOR没定义再试一下这两个
    #define TVM_SETBKCOLOR  (TV_FIRST+29)
    #define TVM_SETTEXTCOLOR (TV_FIRST+30)