# C1.Framework.Drawing.Gdi.DeviceContexts.DeviceContext.Copy

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Framework_Drawing_Gdi_DeviceContexts_DeviceContext_Copy_" data-uid="C1.Framework.Drawing.Gdi.DeviceContexts.DeviceContext.Copy*">Copy Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Framework_Drawing_Gdi_DeviceContexts_DeviceContext_Copy_" data-uid="C1.Framework.Drawing.Gdi.DeviceContexts.DeviceContext.Copy*"></a>
<h4 id="C1_Framework_Drawing_Gdi_DeviceContexts_DeviceContext_Copy_C1_Framework_Drawing_Gdi_DeviceContexts_DeviceContext_System_Drawing_Rectangle_System_Drawing_Point_C1_Framework_Drawing_Gdi_DeviceContexts_RasterOperationCode_" data-uid="C1.Framework.Drawing.Gdi.DeviceContexts.DeviceContext.Copy(C1.Framework.Drawing.Gdi.DeviceContexts.DeviceContext,System.Drawing.Rectangle,System.Drawing.Point,C1.Framework.Drawing.Gdi.DeviceContexts.RasterOperationCode)">Copy(DeviceContext, Rectangle, Point, RasterOperationCode)</h4>
<div class="markdown level1 summary"><p>Performs a bit-block transfer of the color data corresponding to a rectangle of pixels from
the specified source <a class="xref" href="C1.Framework.Drawing.Gdi.DeviceContexts.DeviceContext.html">DeviceContext</a> object into a destination <b>DeviceContext</b> object.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public virtual void Copy(DeviceContext deviceContext, Rectangle destRectangle, Point srcPoint, RasterOperationCode rop)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Overridable Sub Copy(deviceContext As DeviceContext, destRectangle As Rectangle, srcPoint As Point, rop As RasterOperationCode)</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.Framework.Drawing.Gdi.DeviceContexts.DeviceContext.html">DeviceContext</a></td>
      <td><span class="parametername">deviceContext</span></td>
      <td><p>The source <a class="xref" href="C1.Framework.Drawing.Gdi.DeviceContexts.DeviceContext.html">DeviceContext</a> object.</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">destRectangle</span></td>
      <td><p>A <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.rectangle">Rectangle</a> indicates the destination rectangle.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.point">Point</a></td>
      <td><span class="parametername">srcPoint</span></td>
      <td><p>A <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.point">Point</a> indicates the upper-left corner of source rectangle.
The width and height of source rectangle are same as the destination rectangle.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Framework.Drawing.Gdi.DeviceContexts.RasterOperationCode.html">RasterOperationCode</a></td>
      <td><span class="parametername">rop</span></td>
      <td><p>A <a class="xref" href="C1.Framework.Drawing.Gdi.DeviceContexts.DeviceContext.RasterOperationCode.html#C1_Framework_Drawing_Gdi_DeviceContexts_DeviceContext_RasterOperationCode">RasterOperationCode</a> indicates the raster operation code.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Framework_Drawing_Gdi_DeviceContexts_DeviceContext_Copy_C1_Framework_Drawing_Gdi_DeviceContexts_DeviceContext_System_Drawing_Rectangle_System_Drawing_Point_C1_Framework_Drawing_Gdi_DeviceContexts_RasterOperationCode__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>
  Copy only does clipping on the destination DC.
</p>
<p>
  If a rotation or shear transformation is in effect in the source device context, Copy will throw
  a <a class="xref" href="C1.Framework.SystemErrorException.html">SystemErrorException</a>. If other transformations exist in the source device context (and a matching
  transformation is not in effect in the destination device context), the rectangle in the destination device context
  is stretched, compressed, or rotated, as necessary. 
</p>
<p>
  If the color formats of the source and destination device contexts do not match, the Copy function converts
  the source color format to match the destination format. 
</p>
<p>
  When an enhanced metafile is being recorded, an error occurs if the source device context identifies
  an enhanced-metafile device context. it means a <a class="xref" href="C1.Framework.SystemErrorException.html">SystemErrorException</a> would be throw out.
</p>
<p>
  Not all devices support the Copy function. For more information, see the <b>RC_BITBLT</b> raster capability entry
  in the <b>GetDeviceCaps</b> function as well as the following: <b>MaskBlt</b>, <b>PlgBlt</b>, and <b>StretchBlt</b>.
</p>
</div>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Condition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="C1.Framework.SystemErrorException.html">SystemErrorException</a></td>
      <td></td>
    </tr>
  </tbody>
</table>


<a id="C1_Framework_Drawing_Gdi_DeviceContexts_DeviceContext_Copy_" data-uid="C1.Framework.Drawing.Gdi.DeviceContexts.DeviceContext.Copy*"></a>
<h4 id="C1_Framework_Drawing_Gdi_DeviceContexts_DeviceContext_Copy_C1_Framework_Drawing_Gdi_DeviceContexts_DeviceContext_System_Drawing_Rectangle_System_Drawing_Rectangle_C1_Framework_Drawing_Gdi_DeviceContexts_RasterOperationCode_" data-uid="C1.Framework.Drawing.Gdi.DeviceContexts.DeviceContext.Copy(C1.Framework.Drawing.Gdi.DeviceContexts.DeviceContext,System.Drawing.Rectangle,System.Drawing.Rectangle,C1.Framework.Drawing.Gdi.DeviceContexts.RasterOperationCode)">Copy(DeviceContext, Rectangle, Rectangle, RasterOperationCode)</h4>
<div class="markdown level1 summary"><p>Performs a bit-block transfer of the color data corresponding to a rectangle of pixels from
the specified source <a class="xref" href="C1.Framework.Drawing.Gdi.DeviceContexts.DeviceContext.html">DeviceContext</a> object into a destination <b>DeviceContext</b> object.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public virtual void Copy(DeviceContext deviceContext, Rectangle destRectangle, Rectangle srcRectangle, RasterOperationCode rop)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Overridable Sub Copy(deviceContext As DeviceContext, destRectangle As Rectangle, srcRectangle As Rectangle, rop As RasterOperationCode)</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.Framework.Drawing.Gdi.DeviceContexts.DeviceContext.html">DeviceContext</a></td>
      <td><span class="parametername">deviceContext</span></td>
      <td><p>The source <a class="xref" href="C1.Framework.Drawing.Gdi.DeviceContexts.DeviceContext.html">DeviceContext</a> object.</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">destRectangle</span></td>
      <td><p>A <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.rectangle">Rectangle</a> indicates the destination rectangle.</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">srcRectangle</span></td>
      <td><p>A <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.rectangle">Rectangle</a> indicates the source rectangle.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Framework.Drawing.Gdi.DeviceContexts.RasterOperationCode.html">RasterOperationCode</a></td>
      <td><span class="parametername">rop</span></td>
      <td><p>A <a class="xref" href="C1.Framework.Drawing.Gdi.DeviceContexts.DeviceContext.RasterOperationCode.html#C1_Framework_Drawing_Gdi_DeviceContexts_DeviceContext_RasterOperationCode">RasterOperationCode</a> indicates the raster operation code.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Framework_Drawing_Gdi_DeviceContexts_DeviceContext_Copy_C1_Framework_Drawing_Gdi_DeviceContexts_DeviceContext_System_Drawing_Rectangle_System_Drawing_Rectangle_C1_Framework_Drawing_Gdi_DeviceContexts_RasterOperationCode__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>
  Copy only does clipping on the destination DC.
</p>
</div>
<h5 class="exceptions">Exceptions</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Condition</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="C1.Framework.SystemErrorException.html">SystemErrorException</a></td>
      <td></td>
    </tr>
  </tbody>
</table>
</div>
