Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Setting a Background to CTreeCtrl

Posted on 1998-09-10
3
Medium Priority
?
273 Views
Last Modified: 2013-11-20
I want to change the background color of a tree control to black and the foreground to white.

I know there is a solution for that in codeGuru's site.
(http://www.codeguru.com/treeview/ctrl_color.shtml).
But, It seems that this solution dose'nt work well in Visual-C/5.0 or later. When I'm using it, the Tree's area filled with garbage when expanding/collapsing branches.

Any Idea, or a different solution for that problem?

0
Comment
Question by:motigust
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Expert Comment

by:prasanth
ID: 1322045
If you have VC++6 use CTreeCtrl::SetBkColor()
If you dont' have VC++6, send a TVM_SETBKCOLOR message to the control with the wParam=0 and lParam=COLORREF of the color you want. And use
#define TVM_SETBKCOLOR              (TV_FIRST + 29)

0
 
LVL 1

Author Comment

by:motigust
ID: 1322046
This is working the same as using GetCtlColor, The window background is painted with black, but the text/Icons/Lines appears with ugly white rectangled background.

0
 
LVL 2

Accepted Solution

by:
prasanth earned 400 total points
ID: 1322047
There is a TVM_SETTEXTCOLOR but it looks like you need something like SetTextBkColor (which the list view control has). Unfortunately that does not exist for the tree view control. You will need to do a owner drawn tree control. CodeGuru has some samples of owner drawn tree controls and VC comes with some too.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question