# C1.Win.FlexGrid.IC1FlexGridRowDetail.UpdateSize

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Win_FlexGrid_IC1FlexGridRowDetail_UpdateSize_" data-uid="C1.Win.FlexGrid.IC1FlexGridRowDetail.UpdateSize*">UpdateSize Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Win_FlexGrid_IC1FlexGridRowDetail_UpdateSize_" data-uid="C1.Win.FlexGrid.IC1FlexGridRowDetail.UpdateSize*"></a>
<h4 id="C1_Win_FlexGrid_IC1FlexGridRowDetail_UpdateSize_C1_Win_FlexGrid_C1FlexGrid_System_Int32_System_Drawing_Size_" data-uid="C1.Win.FlexGrid.IC1FlexGridRowDetail.UpdateSize(C1.Win.FlexGrid.C1FlexGrid,System.Int32,System.Drawing.Size)">UpdateSize(C1FlexGrid, int, Size)</h4>
<div class="markdown level1 summary"><p>Used to update size of the control.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">void UpdateSize(C1FlexGrid parentGrid, int rowIndex, Size proposedSize)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Sub UpdateSize(parentGrid As C1FlexGrid, rowIndex As Integer, proposedSize 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="C1.Win.FlexGrid.C1FlexGrid.html">C1FlexGrid</a></td>
      <td><span class="parametername">parentGrid</span></td>
      <td><p>FlexGrid which displays detail control.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">rowIndex</span></td>
      <td><p>Index of parent detail row.</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">proposedSize</span></td>
      <td><p>The proposed size for the detail control.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="C1_Win_FlexGrid_IC1FlexGridRowDetail_UpdateSize_C1_Win_FlexGrid_C1FlexGrid_System_Int32_System_Drawing_Size__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>The detail control should update its size in this method.</p>
<p>Height of the detail row will be adjusted based on the height of the control.</p>
<p>The easiest way to update size is to assign value of <code class="paramref">proposedSize</code> parameter.
The width of proposed size is the width of all cells from first non-fixed to last.
The height of proposed size is the current height of the control.</p>
</div>
<h5 id="C1_Win_FlexGrid_IC1FlexGridRowDetail_UpdateSize_C1_Win_FlexGrid_C1FlexGrid_System_Int32_System_Drawing_Size__examples">Examples</h5>
<p>The code below shows the implementation of UpdateSize method using proposedSize parameter:</p>
<pre><code class="lang-csharp">void IC1FlexGridRowDetail.UpdateSize(C1FlexGrid parentGrid, int rowIndex, Size proposedSize)
{ 
    // assign proposedSize as control's size
    Size = proposedSize; 
}</code></pre>
<p>The code below shows the basic implementation of UpdateSize method for detail control derived from C1Label:</p>
<pre><code class="lang-csharp">void IC1FlexGridRowDetail.UpdateSize(C1FlexGrid parentGrid, int rowIndex, Size proposedSize)
{ 
    // accuire size of partent grid's scrollable area
    var srSz = parentGrid.ScrollableRectangle.Size; 

    // measure the size of C1Label's text, which fits into parent's grid scrollable area width
    var sz = TextRenderer.MeasureText(Text, Font, srSz, TextFormatFlags.WordBreak);

    // chose the maximum width between scrollable area and measured text
    sz.Width = Math.Max(sz.Width, srSz.Width); 

    // assign calculated size as control's size
    Size = sz;
}</code></pre>

</div>
