Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTTreeCtrl Background and text colors
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTTreeCtrl Background and text colors

 Post Reply Post Reply
Author
Message Reverse Sort Order
kstowell View Drop Down
Admin Group
Admin Group


Joined: 25 January 2003
Location: MIchigan, USA
Status: Offline
Points: 496
Post Options Post Options   Thanks (0) Thanks(0)   Quote kstowell Quote  Post ReplyReply Direct Link To This Post Topic: CXTTreeCtrl Background and text colors
    Posted: 07 January 2007 at 1:04pm
Hello,
 
You can use the following base class members to set and get text and background colors for the tree control:

COLORREF CTreeCtrl::SetBkColor( COLORREF clr );
COLORREF CTreeCtrl::GetBkColor( ) const;
COLORREF CTreeCtrl::SetTextColor( COLORREF clr );
COLORREF CTreeCtrl::GetTextColor( ) const;

Example:
// change text color to white and background to dark blue
pTree->SetTextColor(RGB(255, 255, 255));
ASSERT(pTree->GetTextColor() == RGB(255, 255, 255));
pTree->SetBkColor(RGB(0, 0, 128));
ASSERT(pTree->GetBkColor() == RGB(0, 0, 255));
// force repaint immediately
pTree->Invalidate();
 
Hope this helps.
 
Codejock Support
Back to Top
danpetitt View Drop Down
Senior Member
Senior Member


Joined: 17 July 2005
Location: United Kingdom
Status: Offline
Points: 109
Post Options Post Options   Thanks (0) Thanks(0)   Quote danpetitt Quote  Post ReplyReply Direct Link To This Post Posted: 07 January 2007 at 10:52am
There are some overrides you can use to specify a text colour ... GetTextColor I think which passes in an HTREEITEM so you can decide what it should be.
 
As for tree background colour, I think there is one for that as well.
Back to Top
aamirzia View Drop Down
Newbie
Newbie


Joined: 07 December 2006
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote aamirzia Quote  Post ReplyReply Direct Link To This Post Posted: 07 January 2007 at 4:16am
Hi All,
 
I am using CXTTreeCtrl and i want to change the background color of the whole tree ctrl(not only the selected items) and also the text color(when tree item is selected or unselected both cases).
 
Please help me out, i was unable to find any such api in CXTTreeCtrl class.
 
Thanx
 
Aamir
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.141 seconds.