0

Why this DataGridView control has a gray strips? How can I overcome this problem?

enter image description here

Peter17
  • 3,052
  • 9
  • 47
  • 77

2 Answers2

2

You can set the border-color of the datagridview as the required one. Also you can change the background color of the datagridview as you required.

Bhavik Goyal
  • 2,786
  • 6
  • 23
  • 42
  • Thanks. It might be a workaround. But, I am still confused why dataGridView takes more place that it needs for displaying all cells. – Peter17 May 24 '11 at 08:49
  • you can edit the area also by setting the width of the datagridview. Else you can also set the width of the column to fill the datagridview work space. Moreover if you set the backgroundcolor of the datagridview to "Control" then it will not show the gray color and will resemble the form. – Bhavik Goyal May 24 '11 at 08:52
  • @Peter17 - the rows gray space is a bug, see this post: http://stackoverflow.com/questions/2122985/removing-the-empty-gray-space-in-datagrid-in-c-sharp – BornToCode Aug 06 '12 at 17:25
2

Set AutoSizeColumnsMode to "Fill", it will hide the background and fill with cells. Same set AutoSizeRowsMode to "All Cells"

Lets see it fixes

AjayR
  • 4,169
  • 4
  • 44
  • 78