Board index » delphi » Treenode text does not match background color of Treeview

Treenode text does not match background color of Treeview

I put a TTreeView on my form and changed the color to clSilver.  When
I generate nodes into the tree, either at run time or using the design
time node editor, they appear on a white background.  I can't find any
color or parentcolor property in eitheer TTreeNode or TTreeNodes.
Does anyone know how to get the Treenodes to display with a background
color other than white?

Thanks, Larry.

 

Re:Treenode text does not match background color of Treeview


The only way I saw immediately was to set the Enabled property to False.
That sure does it, but it also makes the text gray and obviously
disables the control.

Which brings up an interesting question. Will your users think that the
control is useable (not read-only) because it is gray. Most of the time
disabled controls "gray-out" the text but leave the background as is.
Read only stuff, such as lables, usually have a gray background and
users probably don't even think about clicking on them.

Just a thought
Glen Stone

Re:Treenode text does not match background color of Treeview


"Glen S. Stone" <gst...@stonemicrodesigns.com> wrote:

Quote
>The only way I saw immediately was to set the Enabled property to False.
>That sure does it, but it also makes the text gray and obviously
>disables the control.

Well, it's even more complicated here, because I do want the control
to be read-only (that is, I don't want the user to be able to do two
single clicks on the tree node to be able to change the text) but I do
want to put code in the OnDblClick event.

Thanks for your help, I'll give it a try.

Re:Treenode text does not match background color of Treeview


Hi

I'm looking for a solution to the same problem. I havn't found it, but I
have some further info to offer:

The TTreeNode background seems not to be set from it's TTreeView control,
but by the system window color.

It turns out that if you set the TTreeView control background to clWhite
and the system window color to f.x. Yellow - the TTreeNodes will be on a
yellow background in a white control.

I've looked at the source for TTreeView / TTreeNodes but have not been able
to find a way changing the node background (transparent would be fine).

Regards
Troels
--
Computers are not really intelligent - it's just something they belive.

Other Threads