Display Full GridLines .NET DataGridView
By default, the background of a DataGridView
is a solid color. The gridlines stop at the end of the grid of actual data leaving an ugly void in the remaining space of the DataGridView
.
A perfect examp开发者_Python百科le of what I want is the gridlines viewed in Microsoft Excel.
How can I continue the gridlines past the datagrid itself to fill the DataGridView
?
Note: VB.NET preferred, C# answers okay
Handle the DataGridView.CellPainting event, because the DataGridView doesn't support this out-of-the-box.
http://social.msdn.microsoft.com/forums/en-US/winforms/thread/2d91bed2-68e9-41f3-9f6e-73de193640e8/
Also, if you want the background color to be the same as grid's change it to white or something...
The simplest solution is to set the .AutoSizeMode
of one or more columns to DataGridViewAutoSizeColumnMode.Fill
. This ensures the columns exactly fill the area of the grid, with no void.
This may not be entirely the effect you want to achieve though.
精彩评论