I have a Datagrid view, and I want to remove the row header for all rows...
I am trying to remove the rounded part as shown in the below figure (Row header)
For that, I have written the code below.... but it's not working...
private void dgvProducts_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
{
e.PaintCells(e.ClipBounds, DataGridViewPaintParts.All);
e.PaintHeader(DataGridViewPaintParts.All
| DataGridViewPaintParts.Border
| DataGridViewPaintParts.None
| DataGridViewPaintParts.SelectionB开发者_JAVA百科ackground
| DataGridViewPaintParts.ContentBackground);
e.Handled = true;
}
Would any pls give any sample code for removing the row header in Datagrid view .....
Many thanks. In advance.....
Look for a RowHeadersVisible property on the DataGridView in the designer.
From here:
DataGridView Class
RowHeadersVisible Gets or sets a value indicating whether the column that contains row headers is displayed.
why are you being so mean at you to work with RowPrePaint when you can simply set this property to false?
精彩评论