# C1.Win.Document.GraphicsHolder.FromDevice

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Win_Document_GraphicsHolder_FromDevice_" data-uid="C1.Win.Document.GraphicsHolder.FromDevice*">FromDevice Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Win_Document_GraphicsHolder_FromDevice_" data-uid="C1.Win.Document.GraphicsHolder.FromDevice*"></a>
<h4 id="C1_Win_Document_GraphicsHolder_FromDevice_C1_Document_MeasurementDevice_System_String_C1_Document_MeasurementDevice__System_String__" data-uid="C1.Win.Document.GraphicsHolder.FromDevice(C1.Document.MeasurementDevice,System.String,C1.Document.MeasurementDevice@,System.String@)">FromDevice(MeasurementDevice, string, out MeasurementDevice, out string)</h4>
<div class="markdown level1 summary"><p>Creates a graphics holder from a printer or screen device contexts, depending on passing parameters.
When the holder is disposed, both graphics and the device context are released (DeleteDC is called on the device context).
If <code class="paramref">printerName</code> is null or specifies invalid printer name
then printer will be autoselected from list of available printers,
if no printers are installed then <a class="xref" href="C1.Win.Document.GraphicsHolder.FromScreen.html#C1_Win_Document_GraphicsHolder_FromScreen">FromScreen()</a> method will be called.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static GraphicsHolder FromDevice(MeasurementDevice device, string printerName, out MeasurementDevice actualDevice, out string actualPrinterName)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function FromDevice(device As MeasurementDevice, printerName As String, ByRef actualDevice As MeasurementDevice, ByRef actualPrinterName As String) As GraphicsHolder</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><span class="xref">MeasurementDevice</span></td>
      <td><span class="parametername">device</span></td>
      <td><p>The type of device to use (printer or screen).</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">printerName</span></td>
      <td><p>The name of the printer.</p>
</td>
    </tr>
    <tr>
      <td><span class="xref">MeasurementDevice</span></td>
      <td><span class="parametername">actualDevice</span></td>
      <td><p>The actual device (printer or screen) used to measure the objects of a <a class="xref" href="C1.Win.Document.C1Document.html">C1Document</a> or <b>C1FlexReport</b>.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">actualPrinterName</span></td>
      <td><p>The actual printer name.</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="C1.Win.Document.GraphicsHolder.html">GraphicsHolder</a></td>
      <td><p>The new instance of the graphics holder.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
