title: Drawing text on image
body: <p>I have never worked with drawing before and im having a little issue. I cant seem to get the output of this code to work. </p>
  
  <p>The file is saving but it is not drawing on the text. Can anyone see what i may have done wrong?</p>
  
  <p>EDIT: A silly mistake - the backgrond of the image was white (and the brush colour was!). The text is not centered however as i would have expected. Any ideas why SO? :) </p>
  
  <p>EDIT: Image is below.</p>
  
  <p><img src="https://i.stack.imgur.com/4VLfP.png" alt="enter image description here"></p>
  
  <p>Thanks</p>
  
  <pre><code>Bitmap myBitmap = new Bitmap(@"C:\Users\Scott\desktop\blank.bmp");
  Graphics g = Graphics.FromImage(myBitmap);
  
  g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
  g.DrawString("My\nText", 
               new Font("Tahoma", 20), 
               Brushes.White, 
               new PointF(0, 0));
  
  StringFormat strFormat = new StringFormat();
  strFormat.Alignment = StringAlignment.Center;
  strFormat.LineAlignment = StringAlignment.Center;
  
  g.DrawString("My\nText", 
               new Font("Tahoma", 20), Brushes.White, 
               new RectangleF(0, 0, 500, 500), 
               strFormat);
  myBitmap.Save(@"C:\Users\Scott\desktop\blank1.bmp");
  </code></pre>