title: TextRenderer.DrawText in Bitmap vs OnPaintBackground
body: <p>If I use <code>TextRenderer.DrawText()</code> using the <code>Graphics</code> object provided in the <code>OnPaintBackground</code> my text looks perfect. If I create my own <code>Bitmap</code> and use the <code>Graphics</code> object obtained from my <code>Bitmap</code> my text looks terrible. It looks like it is anti-aliasing the text using black, not the bitmap's background color. I can avoid this problem if I use <code>Graphics.DrawString()</code>, but this method has horrible kerning problems. What should I do? How can I get <code>TextRenderer.DrawText()</code> to anti-alias properly using the Bitmap's contents?</p>
  
  <p><strong>Looks terrible:</strong></p>
  
  <pre><code>Bitmap bmp = new Bitmap(100, 100, PixelFormat.Format32bppArgb);
  using (Graphics g = Graphics.FromImage(bmp))
  {
      g.Clear(Color.Red);
      TextFormatFlags tf = TextFormatFlags.Left;
      TextRenderer.DrawText(g, @"C:\Development\Testing\blag", font, clip, Color.White,
                            Color.Transparent, tf);
  }
  </code></pre>
  
  <p><strong>Looks good, but I want to render this onto a bitmap, NOT onto the control's surface:</strong></p>
  
  <pre><code>protected override void OnPaintBackground(PaintEventArgs e)
  {
      e.Graphics.Clear(Color.Red);
      TextFormatFlags tf = TextFormatFlags.Left;
      TextRenderer.DrawText(e.Graphics, @"C:\Development\Testing\blag", font, clip,
                            Color.White, Color.Transparent, tf);
  }
  </code></pre>
  
  <p>What is the difference?</p>