# C1.Win.Drawing.StringRendererGDIPlus.MeasureSubstring

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Win_Drawing_StringRendererGDIPlus_MeasureSubstring_" data-uid="C1.Win.Drawing.StringRendererGDIPlus.MeasureSubstring*">MeasureSubstring Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Win_Drawing_StringRendererGDIPlus_MeasureSubstring_" data-uid="C1.Win.Drawing.StringRendererGDIPlus.MeasureSubstring*"></a>
<h4 id="C1_Win_Drawing_StringRendererGDIPlus_MeasureSubstring_System_Drawing_Graphics_System_Drawing_Font_System_Drawing_StringFormat_System_Drawing_Rectangle_System_String_System_String_System_Int32_" data-uid="C1.Win.Drawing.StringRendererGDIPlus.MeasureSubstring(System.Drawing.Graphics,System.Drawing.Font,System.Drawing.StringFormat,System.Drawing.Rectangle,System.String,System.String,System.Int32)">MeasureSubstring(Graphics, Font, StringFormat, Rectangle, string, string, int)</h4>
<div class="markdown level1 summary"><p>Gets the bounds for displaying the part of this text.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static Rectangle[] MeasureSubstring(Graphics graphics, Font font, StringFormat stringFormat, Rectangle bounds, string text, string substring, int substringStartIndex)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function MeasureSubstring(graphics As Graphics, font As Font, stringFormat As StringFormat, bounds As Rectangle, text As String, substring As String, substringStartIndex As Integer) As Rectangle()</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.drawing.graphics">Graphics</a></td>
      <td><span class="parametername">graphics</span></td>
      <td><p>The device context.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.font">Font</a></td>
      <td><span class="parametername">font</span></td>
      <td><p>The Font of text.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.stringformat">StringFormat</a></td>
      <td><span class="parametername">stringFormat</span></td>
      <td><p>The text layout information.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.rectangle">Rectangle</a></td>
      <td><span class="parametername">bounds</span></td>
      <td><p>The <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.rectangle">Rectangle</a> that represents the bounds of the text.</p>
</td>
    </tr>
    <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>The text to draw.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">substring</span></td>
      <td><p>The substring to highlight.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">substringStartIndex</span></td>
      <td><p>The position at which the substring starts.</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.rectangle">Rectangle</a>[]</td>
      <td></td>
    </tr>
  </tbody>
</table>


<a id="C1_Win_Drawing_StringRendererGDIPlus_MeasureSubstring_" data-uid="C1.Win.Drawing.StringRendererGDIPlus.MeasureSubstring*"></a>
<h4 id="C1_Win_Drawing_StringRendererGDIPlus_MeasureSubstring_System_Drawing_Graphics_System_Drawing_Font_System_Drawing_StringFormat_System_Drawing_Rectangle_System_String_System_Int32_System_Int32_" data-uid="C1.Win.Drawing.StringRendererGDIPlus.MeasureSubstring(System.Drawing.Graphics,System.Drawing.Font,System.Drawing.StringFormat,System.Drawing.Rectangle,System.String,System.Int32,System.Int32)">MeasureSubstring(Graphics, Font, StringFormat, Rectangle, string, int, int)</h4>
<div class="markdown level1 summary"><p>Gets the bounds for displaying the part of this text.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static Rectangle[] MeasureSubstring(Graphics graphics, Font font, StringFormat stringFormat, Rectangle bounds, string text, int substringStartIndex, int substringLength)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function MeasureSubstring(graphics As Graphics, font As Font, stringFormat As StringFormat, bounds As Rectangle, text As String, substringStartIndex As Integer, substringLength As Integer) As Rectangle()</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.drawing.graphics">Graphics</a></td>
      <td><span class="parametername">graphics</span></td>
      <td><p>The device context.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.font">Font</a></td>
      <td><span class="parametername">font</span></td>
      <td><p>The Font of text.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.stringformat">StringFormat</a></td>
      <td><span class="parametername">stringFormat</span></td>
      <td><p>The text layout information.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.rectangle">Rectangle</a></td>
      <td><span class="parametername">bounds</span></td>
      <td><p>The <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.rectangle">Rectangle</a> that represents the bounds of the text.</p>
</td>
    </tr>
    <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>The text to draw.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">substringStartIndex</span></td>
      <td><p>The position at which the substring starts.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">substringLength</span></td>
      <td><p>The length of substring.</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.rectangle">Rectangle</a>[]</td>
      <td></td>
    </tr>
  </tbody>
</table>


<a id="C1_Win_Drawing_StringRendererGDIPlus_MeasureSubstring_" data-uid="C1.Win.Drawing.StringRendererGDIPlus.MeasureSubstring*"></a>
<h4 id="C1_Win_Drawing_StringRendererGDIPlus_MeasureSubstring_System_Drawing_Graphics_System_Drawing_Font_System_Drawing_StringFormat_System_Drawing_Rectangle_System_String_System_Collections_Generic_IList_System_Drawing_CharacterRange__" data-uid="C1.Win.Drawing.StringRendererGDIPlus.MeasureSubstring(System.Drawing.Graphics,System.Drawing.Font,System.Drawing.StringFormat,System.Drawing.Rectangle,System.String,System.Collections.Generic.IList{System.Drawing.CharacterRange})">MeasureSubstring(Graphics, Font, StringFormat, Rectangle, string, IList&lt;CharacterRange&gt;)</h4>
<div class="markdown level1 summary"><p>Gets the bounds for displaying the part of this text.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static Rectangle[] MeasureSubstring(Graphics graphics, Font font, StringFormat stringFormat, Rectangle bounds, string text, IList&lt;CharacterRange&gt; substringRanges)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function MeasureSubstring(graphics As Graphics, font As Font, stringFormat As StringFormat, bounds As Rectangle, text As String, substringRanges As IList(Of CharacterRange)) As Rectangle()</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.drawing.graphics">Graphics</a></td>
      <td><span class="parametername">graphics</span></td>
      <td><p>The device context.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.font">Font</a></td>
      <td><span class="parametername">font</span></td>
      <td><p>The Font of text.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.stringformat">StringFormat</a></td>
      <td><span class="parametername">stringFormat</span></td>
      <td><p>The text layout information.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.rectangle">Rectangle</a></td>
      <td><span class="parametername">bounds</span></td>
      <td><p>The <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.rectangle">Rectangle</a> that represents the bounds of the text.</p>
</td>
    </tr>
    <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>The text to draw.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.ilist-1">IList</a>&lt;<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.characterrange">CharacterRange</a>&gt;</td>
      <td><span class="parametername">substringRanges</span></td>
      <td><p>Positions and lengths of all occurrences of substrings to highlight.</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.rectangle">Rectangle</a>[]</td>
      <td></td>
    </tr>
  </tbody>
</table>
</div>
