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