title: C# Graphics class: get size of drawn content
body: <p>I am writing to a Graphics object dynamically and don't know the actual size of the final image until all output is passed.</p>
  
  <p>So, I create a large image and create Graphics object from it:</p>
  
  <pre><code>int iWidth = 600;
  int iHeight = 2000;
  
  bmpImage = new Bitmap(iWidth, iHeight);            
  graphics = Graphics.FromImage(bmpImage);
  graphics.Clear(Color.White);        
  </code></pre>
  
  <p>How can I find the actual size of written content, so I will be able to create a new bitmap with this size and copy the content to it.</p>
  
  <p>It is really hard to calculate the content size before drawing it and want to know if there is any other solution.</p>