title: Custom CTreeCtrl - How to modify text / selection color
body: <p>First of all, i would customize - among other things - color of text and selection color(text background).
  For example, text color should be blue;  color of text background should be transparent.
  So, I have overriden OnPaint() method;
  I call SetTextColor() and SetBkColor() functions, but unfortunately I always get invalid colors, or I get an annoying "infinite loop flash" effect.
  Here you can see his complete implementation.</p>
  
  <pre><code>void CustomTree::OnPaint() 
  {
      CPaintDC dc(this);
  
      CDC memDC;
      memDC.CreateCompatibleDC(&amp;dc);
  
      CRect rcClip, rcClient;
      dc.GetClipBox( &amp;rcClip );
      GetClientRect(&amp;rcClient);
  
      CBitmap bitmap;
      bitmap.CreateCompatibleBitmap( &amp;dc, rcClient.Width(), rcClient.Height() );
      memDC.SelectObject( &amp;bitmap );
  
      CRgn rgn;
      rgn.CreateRectRgnIndirect( &amp;rcClip );
      memDC.SelectClipRgn(&amp;rgn);
      rgn.DeleteObject();
  
      /* WHAT IS the correct usage of SetText/Bk Color? */
  
      // ::SetTextColor(memDC, RGB(0, 0, 255));
      // ::SetBkColor(memDC, RGB(0, 0, 255));
      // COLORREF col = SetTextColor(RGB(0,0,255));
      // COLORREF co2 = memDC.SetTextColor(RGB(0,0,255));
  
      // First let the control do its default drawing.
  
      CWnd::DefWindowProc(WM_PAINT, (WPARAM)memDC.m_hDC, 0);
  
      // do some others stuffs...
  
      dc.BitBlt(rcClip.left, rcClip.top, rcClip.Width(), rcClip.Height(), &amp;memDC, 
                  rcClip.left, rcClip.top, SRCCOPY);
  
      memDC.DeleteDC();
  }
  </code></pre>
  
  <p>Where is the error?</p>
  
  <p>Thanks</p>
  
  <p>IT</p>