title: Automatically change font size for a stretched image in a picturebox
body: <p>I have a <code>PictureBox</code> that its size is fixed to 480x360 pixels. I write some text using <code>DrawString</code> on the image in the picturebox. If size of the image that user is selecting for the picturebox is already 480x360, it is no problem!</p>
  
  <p>Problems starts when user is adding an image with smaller or greated size of default 480x360 pixels. In this case the default fonr size that I am writing strings on the images will be either too big or too small.</p>
  
  <p>Is there a way to select font size depending on the images width and height? The pictures I am using in the program mostly are 4:3 ratio.</p>
  
  <p>At the moment I am using the code below...it is somehow working but it is not a good way for doing so. What can be a smarter way?!</p>
  
  <pre><code>        private int GetProperFontSize()
      {
          var width = _bitmap.Width;
  
          if(width &gt; 480 &amp;&amp; width &lt;= 680)
          {
              return 20;
          }
  
          if (width &gt; 680 &amp;&amp; width &lt;= 800)
          {
              return 24;
          }
  
          if (width &gt; 800 &amp;&amp; width &lt;= 1024)
          {
              return 32;
          }
  
          if (width &gt; 1024 &amp;&amp; width &lt;= 1600)
          {
              return 44;
          }
  
          if (width &gt; 1600 &amp;&amp; width &lt;= 2048)
          {
              return 50;
          }
  
          if (width &gt; 2048 &amp;&amp; width &lt;= 2560)
          {
              return 66;
          }
  
          if (width &gt; 2560 &amp;&amp; width &lt;= 6000)
          {
              return 80;
          }
  
          return 16;
      }
  </code></pre>