# GrapeCity.Documents.Common.Unit.Convert

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Common_Unit_Convert_" data-uid="GrapeCity.Documents.Common.Unit.Convert*">Convert Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Common_Unit_Convert_" data-uid="GrapeCity.Documents.Common.Unit.Convert*"></a>
<h4 id="GrapeCity_Documents_Common_Unit_Convert_GrapeCity_Documents_Common_UnitTypeEnum_" data-uid="GrapeCity.Documents.Common.Unit.Convert(GrapeCity.Documents.Common.UnitTypeEnum)">Convert(UnitTypeEnum)</h4>
<div class="markdown level1 summary"><p>Converts value of this <a class="xref" href="GrapeCity.Documents.Common.Unit.html">Unit</a> structure to value in specified units of measurement.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public float Convert(UnitTypeEnum to)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function Convert([to] As UnitTypeEnum) 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="GrapeCity.Documents.Common.UnitTypeEnum.html">UnitTypeEnum</a></td>
      <td><span class="parametername">to</span></td>
      <td><p>The target unit of measurement.</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.single">float</a></td>
      <td><p>Returns the value in <code class="paramref">to</code> units.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Common_Unit_Convert_" data-uid="GrapeCity.Documents.Common.Unit.Convert*"></a>
<h4 id="GrapeCity_Documents_Common_Unit_Convert_System_Single_System_Single_GrapeCity_Documents_Common_UnitTypeEnum_" data-uid="GrapeCity.Documents.Common.Unit.Convert(System.Single,System.Single,GrapeCity.Documents.Common.UnitTypeEnum)">Convert(float, float, UnitTypeEnum)</h4>
<div class="markdown level1 summary"><p>Converts a value from pixel unit of measurement to another.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static float Convert(float value, float fromDpi, UnitTypeEnum to)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function Convert(value As Single, fromDpi As Single, [to] As UnitTypeEnum) 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.single">float</a></td>
      <td><span class="parametername">value</span></td>
      <td><p>The value to convert in pixels.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">fromDpi</span></td>
      <td><p>The source dpi.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Documents.Common.UnitTypeEnum.html">UnitTypeEnum</a></td>
      <td><span class="parametername">to</span></td>
      <td><p>The target unit of measurement.</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.single">float</a></td>
      <td><p><code class="paramref">value</code> converted to <code class="paramref">to</code> units.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Common_Unit_Convert_" data-uid="GrapeCity.Documents.Common.Unit.Convert*"></a>
<h4 id="GrapeCity_Documents_Common_Unit_Convert_System_Single_GrapeCity_Documents_Common_UnitTypeEnum_System_Single_" data-uid="GrapeCity.Documents.Common.Unit.Convert(System.Single,GrapeCity.Documents.Common.UnitTypeEnum,System.Single)">Convert(float, UnitTypeEnum, float)</h4>
<div class="markdown level1 summary"><p>Converts a value from one unit of measurement to pixel.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static float Convert(float value, UnitTypeEnum from, float toDpi)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function Convert(value As Single, from As UnitTypeEnum, toDpi As Single) 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.single">float</a></td>
      <td><span class="parametername">value</span></td>
      <td><p>The value to convert in <code class="paramref">from</code> units.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Documents.Common.UnitTypeEnum.html">UnitTypeEnum</a></td>
      <td><span class="parametername">from</span></td>
      <td><p>The source unit of measurement.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">toDpi</span></td>
      <td><p>The target dpi.</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.single">float</a></td>
      <td><p><code class="paramref">value</code> converted to pixels with specified dpi.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Common_Unit_Convert_" data-uid="GrapeCity.Documents.Common.Unit.Convert*"></a>
<h4 id="GrapeCity_Documents_Common_Unit_Convert_System_Single_GrapeCity_Documents_Common_UnitTypeEnum_GrapeCity_Documents_Common_UnitTypeEnum_" data-uid="GrapeCity.Documents.Common.Unit.Convert(System.Single,GrapeCity.Documents.Common.UnitTypeEnum,GrapeCity.Documents.Common.UnitTypeEnum)">Convert(float, UnitTypeEnum, UnitTypeEnum)</h4>
<div class="markdown level1 summary"><p>Converts a value from one unit of measurement to another.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static float Convert(float value, UnitTypeEnum from, UnitTypeEnum to)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function Convert(value As Single, from As UnitTypeEnum, [to] As UnitTypeEnum) 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.single">float</a></td>
      <td><span class="parametername">value</span></td>
      <td><p>The value to convert.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Documents.Common.UnitTypeEnum.html">UnitTypeEnum</a></td>
      <td><span class="parametername">from</span></td>
      <td><p>The source unit of measurement.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Documents.Common.UnitTypeEnum.html">UnitTypeEnum</a></td>
      <td><span class="parametername">to</span></td>
      <td><p>The target unit of measurement.</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.single">float</a></td>
      <td><p><code class="paramref">value</code> converted to <code class="paramref">to</code> units.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
