DatagridView: Remove unused space?

Seb picture Seb · Jan 29, 2010 · Viewed 18.8k times · Source

I was wondering whether it is possible to remove the unused space ( the gray space ) of the DataGridView control in C#. I have to make the DataGridView display the white table only.

Any suggestions?

Note: This post originally contained an external image that is no longer valid

Answer

BornToCode picture BornToCode · Aug 6, 2012

Sometimes (especially with winforms) the best way is to hack:

dataGridView1.BackgroundColor = System.Drawing.SystemColors.Control;

I stole it from this post: removing the empty gray space in datagrid in c#