# GrapeCity.ActiveReports.Design.Advanced.DesignerForm.GetDCEx

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_ActiveReports_Design_Advanced_DesignerForm_GetDCEx_" data-uid="GrapeCity.ActiveReports.Design.Advanced.DesignerForm.GetDCEx*">GetDCEx Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_ActiveReports_Design_Advanced_DesignerForm_GetDCEx_" data-uid="GrapeCity.ActiveReports.Design.Advanced.DesignerForm.GetDCEx*"></a>
<h4 id="GrapeCity_ActiveReports_Design_Advanced_DesignerForm_GetDCEx_System_IntPtr_System_IntPtr_System_Int32_" data-uid="GrapeCity.ActiveReports.Design.Advanced.DesignerForm.GetDCEx(System.IntPtr,System.IntPtr,System.Int32)">GetDCEx(IntPtr, IntPtr, int)</h4>
<div class="markdown level1 summary"><p>Retrieves a handle to a device context (DC) for the client area of a specified window or for the entire screen.
You can use the returned handle in subsequent GDI functions to draw in the DC.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static extern IntPtr GetDCEx(IntPtr hWnd, IntPtr hRgn, int flags)</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">hWnd</span></td>
      <td><p>A handle to the window whose DC is to be retrieved. If this value is NULL, GetDCEx retrieves the DC for the entire screen.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.intptr">IntPtr</a></td>
      <td><span class="parametername">hRgn</span></td>
      <td><p>A clipping region that may be combined with the visible region of the DC. If the value of flags is DCX_INTERSECTRGN or DCX_EXCLUDERGN,
then the operating system assumes ownership of the region and will automatically delete it when it is no longer needed. Therefore, application
should not reference the region after a successful call to GetDCEx using one of these flags. If hRgn is NULL, the clipping region is ignored.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">flags</span></td>
      <td><p>Specifies how the DC is created. This parameter can be one or more of the DCX_ values.</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 function succeeds, the return value is the handle to the DC for the specified window's client area. If the function fails, the return value
is NULL.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_ActiveReports_Design_Advanced_DesignerForm_GetDCEx_System_IntPtr_System_IntPtr_System_Int32__remarks">Remarks</h5>
<div class="markdown level1 remarks"><pre><code>&lt;p&gt;After painting with a common DC, the ReleaseDC function must be called to release the DC. Class and private DCs do not have to be released. 
</code></pre>
<p>ReleaseDC must be called from the same thread that called GetDCEx. The number of DCs is limited only by available memory.</p>
<p>Note that the function is an imported function from the User32.dll library and is utilized within managed code through platform invocation
services (P/Invoke).</p>
</div>
</div>
