1
You solve this by accessing the property AutoSizeMode
of each column. By default, the columns have AutoSizeMode = NotSet
. You will need to define at least one column as AutoSizeMode = Fill
together with the property FillWeight = 100
.
Example:
this.dataGridView1.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
this.dataGridView1.Columns[1].FillWeight = 100;
Hug.
Try to change to
false
the propertyRowsHeaderVisible
, thus:dataGridView1.RowsHeaderVisible = false;
– stderr
@stderr as
RowHeaderVisible
are already infalse
.. the case would be to find some Autosize for Columnsheader to resize to DGV size.– Maurício Sanches