title: How to change background color of selected node in TreeView using TreeViewDrawMode.OwnerDrawAll?
body: <p>I need to change back colours of selected nodes, when node selected and has focus - back color make green, when selected but doesn't have focus - red. I can't make the difference between selected node with focus on tree view and without. Tree view located in TabPage object.</p>
  
  <pre><code>//...
  this.myTreeView.HideSelection = false;
  //...
  private void myTreeView_drawNode(object sender, DrawTreeNodeEventArgs e)
  {
        Color backColorSelected = System.Drawing.Color.Green;
        Color backColor = System.Drawing.Color.Red;
        // node selected and has focus
        if (((e.State &amp; TreeNodeStates.Selected) != 0) 
        &amp;&amp; (this.myTabControl.Focused)) // this doesn't work, node is always red
        {
            using (SolidBrush brush = new SolidBrush(backColorSelected))
            {
                e.Graphics.FillRectangle(brush, e.Bounds);
            }
        }
        // node selected but doesn't have focus
        else if ((e.State &amp; TreeNodeStates.Selected) != 0)
        {
            using (SolidBrush brush = new SolidBrush(backColor))
            {
               e.Graphics.FillRectangle(brush, e.Bounds);
            }
        }
        // not selected at all
        else
        {
            e.Graphics.FillRectangle(Brushes.White, e.Bounds);
        }
  
        e.Graphics.DrawRectangle(SystemPens.Control, e.Bounds);
  
        TextRenderer.DrawText(e.Graphics,
                               e.Node.Text,
                               e.Node.TreeView.Font,
                               e.Node.Bounds,
                               e.Node.ForeColor);
  }   
  </code></pre>