# C1.Framework.Drawing.Gdi.DeviceContexts.DeviceContext.TextExtentEx

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Framework_Drawing_Gdi_DeviceContexts_DeviceContext_TextExtentEx_" data-uid="C1.Framework.Drawing.Gdi.DeviceContexts.DeviceContext.TextExtentEx*">TextExtentEx Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Framework_Drawing_Gdi_DeviceContexts_DeviceContext_TextExtentEx_" data-uid="C1.Framework.Drawing.Gdi.DeviceContexts.DeviceContext.TextExtentEx*"></a>
<h4 id="C1_Framework_Drawing_Gdi_DeviceContexts_DeviceContext_TextExtentEx_System_String_System_Int32_System_Int32__System_Int32___" data-uid="C1.Framework.Drawing.Gdi.DeviceContexts.DeviceContext.TextExtentEx(System.String,System.Int32,System.Int32@,System.Int32[])">TextExtentEx(string, int, out int, int[])</h4>
<div class="markdown level1 summary"><p>Retrieves the number of characters in a specified string that will fit within a specified space and
fills an array with the text extent for each of those characters.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public Size TextExtentEx(string text, int maxExtent, out int fitCharNumber, int[] fitExtents)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function TextExtentEx(text As String, maxExtent As Integer, ByRef fitCharNumber As Integer, fitExtents As Integer()) 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">text</span></td>
      <td><p>A string for which extents are to be retrieved.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">maxExtent</span></td>
      <td><p>Specifies the maximum allowable width, in logical units, of the formatted string.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">fitCharNumber</span></td>
      <td><p>Receives a count of the maximum number of characters that will fit in the space specified by the
maxExtent parameter.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a>[]</td>
      <td><span class="parametername">fitExtents</span></td>
      <td><p>Pointer to an array of integers that receives partial string extents.
Each element in the array gives the distance, in logical units, between the beginning of the string
and one of the characters that fits in the space specified by the maxExtent parameter.
This array must have at least as many elements as character count in text. The function fills the
array with valid extents for as many characters as are specified by the fitCharNumber parameter.</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>Receives the dimensions of the string, in logical units.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
