# FarPoint.Win.FpCheckBox.GetPreferredSize

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="FarPoint_Win_FpCheckBox_GetPreferredSize_" data-uid="FarPoint.Win.FpCheckBox.GetPreferredSize*">GetPreferredSize Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="FarPoint_Win_FpCheckBox_GetPreferredSize_" data-uid="FarPoint.Win.FpCheckBox.GetPreferredSize*"></a>
<h4 id="FarPoint_Win_FpCheckBox_GetPreferredSize_System_Drawing_Graphics_System_Drawing_Size_System_Object_System_Drawing_Font_System_String_System_String_System_String_System_String_FarPoint_Win_CheckBoxPicture_FarPoint_Win_ButtonTextAlign_System_Boolean_System_Boolean_System_Drawing_Text_HotkeyPrefix_" data-uid="FarPoint.Win.FpCheckBox.GetPreferredSize(System.Drawing.Graphics,System.Drawing.Size,System.Object,System.Drawing.Font,System.String,System.String,System.String,System.String,FarPoint.Win.CheckBoxPicture,FarPoint.Win.ButtonTextAlign,System.Boolean,System.Boolean,System.Drawing.Text.HotkeyPrefix)">GetPreferredSize(Graphics, Size, object, Font, string, string, string, string, CheckBoxPicture, ButtonTextAlign, bool, bool, HotkeyPrefix)</h4>
<div class="markdown level1 summary"><p>Calculates the height and width to display the text and picture in the check box.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static Size GetPreferredSize(Graphics g, Size size, object value, Font f, string textTrue, string textFalse, string textGray, string caption, CheckBoxPicture pict, ButtonTextAlign align, bool bKeyDown, bool bMouseDown, HotkeyPrefix prefix)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function GetPreferredSize(g As Graphics, size As Size, value As Object, f As Font, textTrue As String, textFalse As String, textGray As String, caption As String, pict As CheckBoxPicture, align As ButtonTextAlign, bKeyDown As Boolean, bMouseDown As Boolean, prefix As HotkeyPrefix) As Size</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.drawing.graphics">Graphics</a></td>
      <td><span class="parametername">g</span></td>
      <td><p>Graphics device interface for drawing; GDI+ graphics surface</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.size">Size</a></td>
      <td><span class="parametername">size</span></td>
      <td><p>Preferred or maximum needed size</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></td>
      <td><span class="parametername">value</span></td>
      <td><p>CheckState constant specifying the check box state, or null (or non-CheckState value) to use as the current state of the check box</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.font">Font</a></td>
      <td><span class="parametername">f</span></td>
      <td><p>Font for computing the height and width</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">textTrue</span></td>
      <td><p>String of text when the check box is checked (true)</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">textFalse</span></td>
      <td><p>String of text when the check box is unchecked (false)</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">textGray</span></td>
      <td><p>String of text when the check box is gray (indeterminate)</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></td>
      <td><span class="parametername">caption</span></td>
      <td><p>String of text if none of the other text values are set</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="FarPoint.Win.CheckBoxPicture.html">CheckBoxPicture</a></td>
      <td><span class="parametername">pict</span></td>
      <td><p>Picture (image) for the check box</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="FarPoint.Win.ButtonTextAlign.html">ButtonTextAlign</a></td>
      <td><span class="parametername">align</span></td>
      <td><p>Alignment of the text and check box</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">bKeyDown</span></td>
      <td><p>Whether the key down</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">bMouseDown</span></td>
      <td><p>Whether the mouse down</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.text.hotkeyprefix">HotkeyPrefix</a></td>
      <td><span class="parametername">prefix</span></td>
      <td><p>Hotkey prefix</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.drawing.size">Size</a></td>
      <td><p>An ordered pair of type Size representing the width and height.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
