DataGridView Column Widths as Percentage

Brett Powell picture Brett Powell · Mar 22, 2013 · Viewed 21.3k times · Source

Is there any way to give each column in a DataGridView a percentage width of the total grid? I am currently using fixed widths but would like to give one column a 15% width, another one a 25% width, and so on so that 100% of the table is filled and resizes with the Grid.

Answer

Aseem Gautam picture Aseem Gautam · Mar 22, 2013

Try using the DataGridViewColumn.FillWeight property. Basically you assign a weight to every column and the columns re-size according to those weights. The MSDN arcticle is not that great. See the below article for better explaination -

Presenting Data with the DataGridView Control in .NET 2.0—Automatic Column Sizing