0

I can easily change cellborderstyle in visual studio to none or fixed3d or single. But the single line is one pixel width. I want thicker, how do I change that.

Iluvathar
  • 43
  • 1
  • 7
  • I think there is no simple way to do it. You will have to do your own painting as explained in this SO post: [How do you draw a border around a DataGridView cell while it's being edited?](https://stackoverflow.com/questions/32154847/how-do-you-draw-a-border-around-a-datagridview-cell-while-its-being-edited). – Olivier Jacot-Descombes Apr 17 '19 at 13:16
  • This looks usefull. Does it resize well? Well I will check it tomorow at work. – Iluvathar Apr 17 '19 at 19:00
  • It should, as OnPaint will be called repeatedly during resizing. – Olivier Jacot-Descombes Apr 17 '19 at 20:09
  • Possible duplicate of [How to set gridview cell border thickness in vb.net windows forms?](https://stackoverflow.com/questions/55704025/how-to-set-gridview-cell-border-thickness-in-vb-net-windows-forms) – Federico Navarrete Apr 19 '19 at 12:50

1 Answers1

1

The closest you could get without drawing your own would be to set the DividerWidth property to your desired thickness

    For Each DgvCol As DataGridViewColumn In DataGridView1.Columns
        DgvCol.DividerWidth = 10
    Next

Edit- To set row divider height I might use the row prepaint event to spare resources on load:

Private Sub DataGridView1_RowPrePaint(sender As Object, e As DataGridViewRowPrePaintEventArgs) Handles DataGridView1.RowPrePaint
    DataGridView1.Rows(e.RowIndex).DividerHeight = 5
End Sub
Mr. Tripodi
  • 809
  • 1
  • 6
  • 7
  • Well what about borders of datagrid? – Iluvathar Apr 17 '19 at 19:01
  • Oops, I thought you were referring to the cells. Maybe what you could do is put the dgv into a panel which has padding set to your desired thickness and change the background color to color you want -I edited my answer – Mr. Tripodi Apr 17 '19 at 19:08
  • Since the panel becomes the border, you would want the grid to have no border then. – LarsTech Apr 17 '19 at 19:13
  • I was reffering to the cells, was thinking your solution only thickens lines between cells, Can you post your old answer pls, since I want to see the code. – Iluvathar Apr 18 '19 at 14:14
  • Previously I suggested the DividerWidth on the DGV Columns – Mr. Tripodi Apr 18 '19 at 14:19
  • Well this doesnt work on the first line of cells, since it id just for between the cells as I fought. And since you cannot set datagrid border width it does not work. – Iluvathar May 06 '19 at 12:18