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>
Set the RowsHeaderVisible property to false, you can either do that from the designer, in category Appearence, or from the code :
dataGridView1.RowsHeaderVisible = false;
In order to remove the indicator row on the left side, as for the rest of the grey space, you can try set the aforementionned AutoSizeColumnsMode to Fill, but you will still have the lower part grayed out from lack of rows.
Instead of sizing your cells to fill your grid, you could resize your grid in order to fit around your cells. Whether or not this is an acceptable approach will depend on your intent.
I mean, it's possible that if its just the color that is bothering you, setting the backcolor to white would do the trick.