# C1.Util.DX.DirectWrite.TextLayout.Draw

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Util_DX_DirectWrite_TextLayout_Draw_" data-uid="C1.Util.DX.DirectWrite.TextLayout.Draw*">Draw Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Util_DX_DirectWrite_TextLayout_Draw_" data-uid="C1.Util.DX.DirectWrite.TextLayout.Draw*"></a>
<h4 id="C1_Util_DX_DirectWrite_TextLayout_Draw_C1_Util_DX_DirectWrite_TextRenderer_System_Single_System_Single_" data-uid="C1.Util.DX.DirectWrite.TextLayout.Draw(C1.Util.DX.DirectWrite.TextRenderer,System.Single,System.Single)">Draw(TextRenderer, float, float)</h4>
<div class="markdown level1 summary"><p>Draws text using the specified client drawing context.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void Draw(TextRenderer renderer, float originX, float originY)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub Draw(renderer As TextRenderer, originX As Single, originY As Single)</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="C1.Util.DX.DirectWrite.TextRenderer.html">TextRenderer</a></td>
      <td><span class="parametername">renderer</span></td>
      <td><p>Pointer to the set of callback functions used to draw parts of a text string.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">originX</span></td>
      <td><p>The x-coordinate of the layout's left side.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">originY</span></td>
      <td><p>The y-coordinate of the layout's top side.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Util_DX_DirectWrite_TextLayout_Draw_C1_Util_DX_DirectWrite_TextRenderer_System_Single_System_Single__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>To draw text with this method, a textLayout object needs to be created by the application using <a class="xref" href="C1.Util.DX.DirectWrite.Factory.CreateTextLayout.html#C1_Util_DX_DirectWrite_Factory_CreateTextLayout_System_String_System_Int32_C1_Util_DX_DirectWrite_TextFormat_System_Single_System_Single_">CreateTextLayout(string, int, TextFormat, float, float)</a>. After the textLayout object is obtained, the application calls the  IDWriteTextLayout::Draw method  to draw the text, decorations, and inline objects. The actual drawing is done through the callback interface passed in as the textRenderer argument; there, the corresponding DrawGlyphRun API is called.</p>
</div>


<a id="C1_Util_DX_DirectWrite_TextLayout_Draw_" data-uid="C1.Util.DX.DirectWrite.TextLayout.Draw*"></a>
<h4 id="C1_Util_DX_DirectWrite_TextLayout_Draw_System_Object_C1_Util_DX_DirectWrite_TextRenderer_System_Single_System_Single_" data-uid="C1.Util.DX.DirectWrite.TextLayout.Draw(System.Object,C1.Util.DX.DirectWrite.TextRenderer,System.Single,System.Single)">Draw(object, TextRenderer, float, float)</h4>
<div class="markdown level1 summary"><p>Draws text using the specified client drawing context.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void Draw(object clientDrawingContext, TextRenderer renderer, float originX, float originY)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub Draw(clientDrawingContext As Object, renderer As TextRenderer, originX As Single, originY As Single)</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.object">object</a></td>
      <td><span class="parametername">clientDrawingContext</span></td>
      <td><p>An application-defined drawing context.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.DirectWrite.TextRenderer.html">TextRenderer</a></td>
      <td><span class="parametername">renderer</span></td>
      <td><p>Pointer to the set of callback functions used to draw parts of a text string.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">originX</span></td>
      <td><p>The x-coordinate of the layout's left side.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">originY</span></td>
      <td><p>The y-coordinate of the layout's top side.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Util_DX_DirectWrite_TextLayout_Draw_System_Object_C1_Util_DX_DirectWrite_TextRenderer_System_Single_System_Single__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>To draw text with this method, a textLayout object needs to be created by the application using <a class="xref" href="C1.Util.DX.DirectWrite.Factory.CreateTextLayout.html#C1_Util_DX_DirectWrite_Factory_CreateTextLayout_System_String_System_Int32_C1_Util_DX_DirectWrite_TextFormat_System_Single_System_Single_">CreateTextLayout(string, int, TextFormat, float, float)</a>. After the textLayout object is obtained, the application calls the  IDWriteTextLayout::Draw method  to draw the text, decorations, and inline objects. The actual drawing is done through the callback interface passed in as the textRenderer argument; there, the corresponding DrawGlyphRun API is called.</p>
</div>
</div>
