# C1.Util.DX.Direct2D.RenderTarget.DrawText

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Util_DX_Direct2D_RenderTarget_DrawText_" data-uid="C1.Util.DX.Direct2D.RenderTarget.DrawText*">DrawText Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Util_DX_Direct2D_RenderTarget_DrawText_" data-uid="C1.Util.DX.Direct2D.RenderTarget.DrawText*"></a>
<h4 id="C1_Util_DX_Direct2D_RenderTarget_DrawText_System_String_C1_Util_DX_DirectWrite_TextFormat_C1_Util_DX_RectF_C1_Util_DX_Direct2D_Brush_" data-uid="C1.Util.DX.Direct2D.RenderTarget.DrawText(System.String,C1.Util.DX.DirectWrite.TextFormat,C1.Util.DX.RectF,C1.Util.DX.Direct2D.Brush)">DrawText(string, TextFormat, RectF, Brush)</h4>
<div class="markdown level1 summary"><p>Draws the specified text using the format information provided by an <span class="xref">C1.Win.DX.DirectWrite.TextFormat</span> object.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void DrawText(string text, TextFormat textFormat, RectF layoutRect, Brush defaultForegroundBrush)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub DrawText(text As String, textFormat As TextFormat, layoutRect As RectF, defaultForegroundBrush As Brush)</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 reference to an array of Unicode characters to draw.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.DirectWrite.TextFormat.html">TextFormat</a></td>
      <td><span class="parametername">textFormat</span></td>
      <td><p>An object that describes formatting details of the text to draw, such as the font, the font size, and flow direction.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.RectF.html">RectF</a></td>
      <td><span class="parametername">layoutRect</span></td>
      <td><p>The size and position of the area in which the text is drawn.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.Direct2D.Brush.html">Brush</a></td>
      <td><span class="parametername">defaultForegroundBrush</span></td>
      <td><p>The brush used to paint the text.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Util_DX_Direct2D_RenderTarget_DrawText_" data-uid="C1.Util.DX.Direct2D.RenderTarget.DrawText*"></a>
<h4 id="C1_Util_DX_Direct2D_RenderTarget_DrawText_System_String_C1_Util_DX_DirectWrite_TextFormat_C1_Util_DX_RectF_C1_Util_DX_Direct2D_Brush_C1_Util_DX_Direct2D_DrawTextOptions_" data-uid="C1.Util.DX.Direct2D.RenderTarget.DrawText(System.String,C1.Util.DX.DirectWrite.TextFormat,C1.Util.DX.RectF,C1.Util.DX.Direct2D.Brush,C1.Util.DX.Direct2D.DrawTextOptions)">DrawText(string, TextFormat, RectF, Brush, DrawTextOptions)</h4>
<div class="markdown level1 summary"><p>Draws the specified text using the format information provided by an <span class="xref">C1.Win.DX.DirectWrite.TextFormat</span> object.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void DrawText(string text, TextFormat textFormat, RectF layoutRect, Brush defaultForegroundBrush, DrawTextOptions options)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub DrawText(text As String, textFormat As TextFormat, layoutRect As RectF, defaultForegroundBrush As Brush, options As DrawTextOptions)</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 reference to an array of Unicode characters to draw.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.DirectWrite.TextFormat.html">TextFormat</a></td>
      <td><span class="parametername">textFormat</span></td>
      <td><p>An object that describes formatting details of the text to draw, such as the font, the font size, and flow direction.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.RectF.html">RectF</a></td>
      <td><span class="parametername">layoutRect</span></td>
      <td><p>The size and position of the area in which the text is drawn.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.Direct2D.Brush.html">Brush</a></td>
      <td><span class="parametername">defaultForegroundBrush</span></td>
      <td><p>The brush used to paint the text.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.Direct2D.DrawTextOptions.html">DrawTextOptions</a></td>
      <td><span class="parametername">options</span></td>
      <td><p>A value that indicates whether the text should be snapped to pixel boundaries and whether the text should be clipped to the layout rectangle. The default value is <span class="xref">C1.Win.DX.Direct2D.DrawTextOptions.None</span>, which indicates that text should be snapped to pixel boundaries and it should not be clipped to the layout rectangle.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Util_DX_Direct2D_RenderTarget_DrawText_" data-uid="C1.Util.DX.Direct2D.RenderTarget.DrawText*"></a>
<h4 id="C1_Util_DX_Direct2D_RenderTarget_DrawText_System_String_C1_Util_DX_DirectWrite_TextFormat_C1_Util_DX_RectF_C1_Util_DX_Direct2D_Brush_C1_Util_DX_Direct2D_DrawTextOptions_C1_Util_DX_DirectWrite_MeasuringMode_" data-uid="C1.Util.DX.Direct2D.RenderTarget.DrawText(System.String,C1.Util.DX.DirectWrite.TextFormat,C1.Util.DX.RectF,C1.Util.DX.Direct2D.Brush,C1.Util.DX.Direct2D.DrawTextOptions,C1.Util.DX.DirectWrite.MeasuringMode)">DrawText(string, TextFormat, RectF, Brush, DrawTextOptions, MeasuringMode)</h4>
<div class="markdown level1 summary"><p>Draws the specified text using the format information provided by an <span class="xref">C1.Win.DX.DirectWrite.TextFormat</span> object.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void DrawText(string text, TextFormat textFormat, RectF layoutRect, Brush defaultForegroundBrush, DrawTextOptions options, MeasuringMode measuringMode)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub DrawText(text As String, textFormat As TextFormat, layoutRect As RectF, defaultForegroundBrush As Brush, options As DrawTextOptions, measuringMode As MeasuringMode)</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 reference to an array of Unicode characters to draw.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.DirectWrite.TextFormat.html">TextFormat</a></td>
      <td><span class="parametername">textFormat</span></td>
      <td><p>An object that describes formatting details of the text to draw, such as the font, the font size, and flow direction.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.RectF.html">RectF</a></td>
      <td><span class="parametername">layoutRect</span></td>
      <td><p>The size and position of the area in which the text is drawn.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.Direct2D.Brush.html">Brush</a></td>
      <td><span class="parametername">defaultForegroundBrush</span></td>
      <td><p>The brush used to paint the text.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.Direct2D.DrawTextOptions.html">DrawTextOptions</a></td>
      <td><span class="parametername">options</span></td>
      <td><p>A value that indicates whether the text should be snapped to pixel boundaries and whether the text should be clipped to the layout rectangle. The default value is <span class="xref">C1.Win.DX.Direct2D.DrawTextOptions.None</span>, which indicates that text should be snapped to pixel boundaries and it should not be clipped to the layout rectangle.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.DirectWrite.MeasuringMode.html">MeasuringMode</a></td>
      <td><span class="parametername">measuringMode</span></td>
      <td><p>A value that indicates how glyph metrics are used to measure text when it is formatted.  The default value is DWRITE_MEASURING_MODE_NATURAL.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Util_DX_Direct2D_RenderTarget_DrawText_" data-uid="C1.Util.DX.Direct2D.RenderTarget.DrawText*"></a>
<h4 id="C1_Util_DX_Direct2D_RenderTarget_DrawText_System_String_System_Int32_C1_Util_DX_DirectWrite_TextFormat_C1_Util_DX_RectF_C1_Util_DX_Direct2D_Brush_C1_Util_DX_Direct2D_DrawTextOptions_C1_Util_DX_DirectWrite_MeasuringMode_" data-uid="C1.Util.DX.Direct2D.RenderTarget.DrawText(System.String,System.Int32,C1.Util.DX.DirectWrite.TextFormat,C1.Util.DX.RectF,C1.Util.DX.Direct2D.Brush,C1.Util.DX.Direct2D.DrawTextOptions,C1.Util.DX.DirectWrite.MeasuringMode)">DrawText(string, int, TextFormat, RectF, Brush, DrawTextOptions, MeasuringMode)</h4>
<div class="markdown level1 summary"><p>void ID2D1RenderTarget::DrawText([In, Buffer] const wchar_t* string,[In] unsigned int stringLength,[In] IDWriteTextFormat* textFormat,[In] const D2D_RECT_F* layoutRect,[In] ID2D1Brush* defaultForegroundBrush,[In] D2D1_DRAW_TEXT_OPTIONS options,[In] DWRITE_MEASURING_MODE measuringMode)</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void DrawText(string text, int stringLength, TextFormat textFormat, RectF layoutRect, Brush defaultForegroundBrush, DrawTextOptions options = DrawTextOptions.None, MeasuringMode measuringMode = MeasuringMode.Natural)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub DrawText(text As String, stringLength As Integer, textFormat As TextFormat, layoutRect As RectF, defaultForegroundBrush As Brush, Optional options As DrawTextOptions = DrawTextOptions.None, Optional measuringMode As MeasuringMode = MeasuringMode.Natural)</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></td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">stringLength</span></td>
      <td></td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.DirectWrite.TextFormat.html">TextFormat</a></td>
      <td><span class="parametername">textFormat</span></td>
      <td></td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.RectF.html">RectF</a></td>
      <td><span class="parametername">layoutRect</span></td>
      <td></td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.Direct2D.Brush.html">Brush</a></td>
      <td><span class="parametername">defaultForegroundBrush</span></td>
      <td></td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.Direct2D.DrawTextOptions.html">DrawTextOptions</a></td>
      <td><span class="parametername">options</span></td>
      <td></td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.DirectWrite.MeasuringMode.html">MeasuringMode</a></td>
      <td><span class="parametername">measuringMode</span></td>
      <td></td>
    </tr>
  </tbody>
</table>
</div>
