# C1.Framework.Drawing.Gdi.Graphics.MeasureString

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Framework_Drawing_Gdi_Graphics_MeasureString_" data-uid="C1.Framework.Drawing.Gdi.Graphics.MeasureString*">MeasureString Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Framework_Drawing_Gdi_Graphics_MeasureString_" data-uid="C1.Framework.Drawing.Gdi.Graphics.MeasureString*"></a>
<h4 id="C1_Framework_Drawing_Gdi_Graphics_MeasureString_System_String_C1_Framework_Drawing_Gdi_Font_System_Drawing_Size_C1_Framework_Drawing_Gdi_StringFormat_" data-uid="C1.Framework.Drawing.Gdi.Graphics.MeasureString(System.String,C1.Framework.Drawing.Gdi.Font,System.Drawing.Size,C1.Framework.Drawing.Gdi.StringFormat)">MeasureString(string, Font, Size, StringFormat)</h4>
<div class="markdown level1 summary"><p>Measures the specified string when drawn with the specified Font object and formatted with the specified StringFormat object.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public Size MeasureString(string s, Font font, Size layoutArea, StringFormat format)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function MeasureString(s As String, font As Font, layoutArea As Size, format As StringFormat) As Size</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">s</span></td>
      <td><p>String to measure.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Framework.Drawing.Gdi.Font.html">Font</a></td>
      <td><span class="parametername">font</span></td>
      <td><p>Font object defines the text format of the string.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.size">Size</a></td>
      <td><span class="parametername">layoutArea</span></td>
      <td><p>Size structure that specifies the maximum layout area for the text.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Framework.Drawing.Gdi.StringFormat.html">StringFormat</a></td>
      <td><span class="parametername">format</span></td>
      <td><p>StringFormat object that represents formatting information, such as line spacing, for the string.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.size">Size</a></td>
      <td><p>The MeasureString method is designed for use with individual strings and includes a small amount
of extra space before and after the string to allow for overhanging glyphs. Also, the DrawString
method adjusts glyph points to optimize display quality and might display a string narrower than
reported by MeasureString.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
