# C1.Win.FlexGrid.C1FlexGrid.AutoSizeCols

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_Win_FlexGrid_C1FlexGrid_AutoSizeCols_" data-uid="C1.Win.FlexGrid.C1FlexGrid.AutoSizeCols*">AutoSizeCols Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_Win_FlexGrid_C1FlexGrid_AutoSizeCols_" data-uid="C1.Win.FlexGrid.C1FlexGrid.AutoSizeCols*"></a>
<h4 id="C1_Win_FlexGrid_C1FlexGrid_AutoSizeCols_System_Drawing_Graphics_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_C1_Win_FlexGrid_AutoSizeFlags_" data-uid="C1.Win.FlexGrid.C1FlexGrid.AutoSizeCols(System.Drawing.Graphics,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,C1.Win.FlexGrid.AutoSizeFlags)">AutoSizeCols(Graphics, int, int, int, int, int, AutoSizeFlags)</h4>
<div class="markdown level1 summary"><p>Automatically size grid columns to fit the largest entry.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">protected override void AutoSizeCols(Graphics g, int row1, int col1, int row2, int col2, int extra, AutoSizeFlags flags)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Protected Overrides Sub AutoSizeCols(g As Graphics, row1 As Integer, col1 As Integer, row2 As Integer, col2 As Integer, extra As Integer, flags As AutoSizeFlags)</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><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.graphics">Graphics</a> object used to measure the cell contents.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">row1</span></td>
      <td><p>Index of the first row to be measured.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">col1</span></td>
      <td><p>Index of the first column to be measured.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">row2</span></td>
      <td><p>Index of the last row to be measured.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">col2</span></td>
      <td><p>Index of the first column to be measured.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">extra</span></td>
      <td><p>Extra space, in twips, to add to the largest entry.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="C1.Win.FlexGrid.AutoSizeFlags.html">AutoSizeFlags</a></td>
      <td><span class="parametername">flags</span></td>
      <td><p><a class="xref" href="C1.Win.FlexGrid.AutoSizeFlags.html">AutoSizeFlags</a> value that specifies auto sizing behavior.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="overrides">Overrides</h5>
<div><a class="xref" href="C1.Win.FlexGrid.C1FlexGridBase.AutoSizeCols.html#C1_Win_FlexGrid_C1FlexGridBase_AutoSizeCols_System_Drawing_Graphics_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_C1_Win_FlexGrid_AutoSizeFlags_">C1FlexGridBase.AutoSizeCols(Graphics, int, int, int, int, int, AutoSizeFlags)</a></div>
<h5 id="C1_Win_FlexGrid_C1FlexGrid_AutoSizeCols_System_Drawing_Graphics_System_Int32_System_Int32_System_Int32_System_Int32_System_Int32_C1_Win_FlexGrid_AutoSizeFlags__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>This method is for internal use. It allows inherited classes to customize the grid appearance.</p>
</div>
</div>
