views:

226

answers:

1

Change the cell border width and also make the cell border only all,left ,right,top,bottom or none in winform datagridview. In datagridview the problem is to change the border style of each cell , as we could do in excel sheet. I have tried following but it didnt work.

DataGridViewAdvancedBorderStyle mystyle = new DataGridViewAdvancedBorderStyle ();
DataGridViewAdvancedBorderStyle myplaceholder = new DataGridViewAdvancedBorderStyle ();
mystyle.Top =DataGridViewAdvancedCellBorderStyle.None;
dataGridView1.Rows[1].Cells[1].AdjustCellBorderStyle(mystyle, myplaceholder, true, true, true, true);
+1  A: 

That's not how it works. It is a virtual method, you're supposed to override it in your own custom DataGridViewCell derived class. And the DataGridView would have to be filled with those custom cells.

Hans Passant