curiosity
curiosity

Reputation: 1233

TreeView selected node problem

i wanted to create a custom treeview so i inherited the treeview class and created 'CustomTreeView' class

there i implemented multiselect concept..

for making the node as selected,

node.BackColor = SystemColors.Highlight;
node.ForeColor = SystemColors.HighlightText;

i used these lines...

but the problem is when i make the control as disabled(ie enabled=false),

the selected node goes invisible..

any other solution to make a node selected??? without this enabled problem?


EDIT: Here is the full function that is called when a node is selected:

private void ToggleNode(TreeNode node, bool bSelectNode)
{
   if (bSelectNode)
   {
      m_SelectedNode = node;

      if (!m_SelectedNodes.Contains(node))
         m_SelectedNodes.Add(node);

      node.BackColor = SystemColors.Highlight;
      node.ForeColor = SystemColors.HighlightText;
   }
   else
   {
      m_SelectedNodes.Remove(node);
      node.BackColor = this.BackColor;
      node.ForeColor = this.ForeColor;
   }
}

Upvotes: 0

Views: 1480

Answers (1)

smirkingman
smirkingman

Reputation: 6368

I suspect it's because Highlight and HighlightText are sufficiently close together that you get this effect with the dimming.

Try Red and Blue. Does it still disappear?

Upvotes: 1

Related Questions