Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

removing row header in datagrid view programmatically

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.SelectionBackground
             | DataGridViewPaintParts.ContentBackground);

         e.Handled = true;

     }

Would any pls give any sample code for removing the row header in Datagrid view .....

Many thanks. In advance.....

like image 703
Glory Raj Avatar asked Sep 06 '11 18:09

Glory Raj


1 Answers

Look for a RowHeadersVisible property on the DataGridView in the designer.

RowHeadersVisible property set to false

like image 56
Grant Winney Avatar answered Oct 15 '22 20:10

Grant Winney