int height = 0; foreach (DataGridViewRow row in dataGridView1.Rows) { height += row.Height; } height += dataGridView1.ColumnHeadersHeight; int width = 0; foreach (DataGridViewColumn col in dataGridView1.Columns) { width += col.Width; } width += dataGridView1.RowHeadersWidth; dataGridView1.ClientSize = new Size(width + 2, height + 2);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)