I have a datagridview with 3 rows and 2 columns. My rows and columns have headers.
The problem is that i have an empty cell on the top left corner of my datagridview. I think it is the column header of my rowheaders or something like that. I don't success to hide this cell, is it possible ?
Thank you
Example :
hide this cell | colHead1| colHead2 |
--------------------------------------
firstname | x | y |
lastname | x1 | y1 |
society | x2 | y2 |
EDIT :
I tried to set the property dtgv.TopLeftHeaderCell.Visible
to False, but it is ReadOnly.
I rescind my comment. You can accomplish this - manually. For example, in your
DataGridView.CellPainting
event handler in a bland/unmodifiedDataGridView
, you can match the background like so:If you meant you want to set the
DataGridView
background to the Form's background these two (C#) answers by users Deumber and letsdance demonstrate the general setup to crop the correct portion of the Form's image into theDataGridView
. Using their methods (without callingSetCellsTransparent()
) coupled with the following change to yourDataGridView.CellPainting
event handler should work: