# C1.Util.DX.DirectWrite.TextLayout.SetDrawingEffect

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Util_DX_DirectWrite_TextLayout_SetDrawingEffect_" data-uid="C1.Util.DX.DirectWrite.TextLayout.SetDrawingEffect*">SetDrawingEffect Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Util_DX_DirectWrite_TextLayout_SetDrawingEffect_" data-uid="C1.Util.DX.DirectWrite.TextLayout.SetDrawingEffect*"></a>
<h4 id="C1_Util_DX_DirectWrite_TextLayout_SetDrawingEffect_System_Object_C1_Util_DX_DirectWrite_TextRange_" data-uid="C1.Util.DX.DirectWrite.TextLayout.SetDrawingEffect(System.Object,C1.Util.DX.DirectWrite.TextRange)">SetDrawingEffect(object, TextRange)</h4>
<div class="markdown level1 summary"><p>Sets the application-defined drawing effect.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public IntPtr SetDrawingEffect(object drawingEffect, TextRange textRange)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function SetDrawingEffect(drawingEffect As Object, textRange As TextRange) As IntPtr</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">drawingEffect</span></td>
      <td><p>Application-defined drawing effects that apply to the range. This data object will be passed back to the application's drawing callbacks for final rendering.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.DirectWrite.TextRange.html">TextRange</a></td>
      <td><span class="parametername">textRange</span></td>
      <td><p>The text range to which this change applies.</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.intptr">IntPtr</a></td>
      <td><p>If the method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Util_DX_DirectWrite_TextLayout_SetDrawingEffect_System_Object_C1_Util_DX_DirectWrite_TextRange__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>An <a class="xref" href="C1.Util.DX.Direct2D.Brush.html">Brush</a>, such as a color or gradient brush, can be set as a drawing effect if you are using the RenderTarget.DrawTextLayout to draw text and that brush will be used to draw the specified range of text.  This drawing effect is associated with the specified range and will be passed back to the application by way of the callback when the range is drawn at drawing time.</p>
</div>


<a id="C1_Util_DX_DirectWrite_TextLayout_SetDrawingEffect_" data-uid="C1.Util.DX.DirectWrite.TextLayout.SetDrawingEffect*"></a>
<h4 id="C1_Util_DX_DirectWrite_TextLayout_SetDrawingEffect_C1_Util_DX_Direct2D_Brush_C1_Util_DX_DirectWrite_TextRange_" data-uid="C1.Util.DX.DirectWrite.TextLayout.SetDrawingEffect(C1.Util.DX.Direct2D.Brush,C1.Util.DX.DirectWrite.TextRange)">SetDrawingEffect(Brush, TextRange)</h4>
<div class="markdown level1 summary"><p>Sets the application-defined drawing effect.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void SetDrawingEffect(Brush brush, TextRange textRange)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub SetDrawingEffect(brush As Brush, textRange As TextRange)</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.Direct2D.Brush.html">Brush</a></td>
      <td><span class="parametername">brush</span></td>
      <td><p>The color or gradient brush.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.DirectWrite.TextRange.html">TextRange</a></td>
      <td><span class="parametername">textRange</span></td>
      <td><p>The text range to which this change applies.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="C1_Util_DX_DirectWrite_TextLayout_SetDrawingEffect_" data-uid="C1.Util.DX.DirectWrite.TextLayout.SetDrawingEffect*"></a>
<h4 id="C1_Util_DX_DirectWrite_TextLayout_SetDrawingEffect_System_IntPtr_C1_Util_DX_DirectWrite_TextRange_" data-uid="C1.Util.DX.DirectWrite.TextLayout.SetDrawingEffect(System.IntPtr,C1.Util.DX.DirectWrite.TextRange)">SetDrawingEffect(IntPtr, TextRange)</h4>
<div class="markdown level1 summary"><p>HRESULT IDWriteTextLayout::SetDrawingEffect([In] void* drawingEffect,[In] DWRITE_TEXT_RANGE textRange)</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void SetDrawingEffect(IntPtr drawingEffect, TextRange textRange)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub SetDrawingEffect(drawingEffect As IntPtr, textRange As TextRange)</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.intptr">IntPtr</a></td>
      <td><span class="parametername">drawingEffect</span></td>
      <td></td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Util.DX.DirectWrite.TextRange.html">TextRange</a></td>
      <td><span class="parametername">textRange</span></td>
      <td></td>
    </tr>
  </tbody>
</table>
</div>
