[RESOLVED] DataGridView RowHeaders
I've created a custom class that inherits from the standard DataGridView that displays both Columns and Row Headers. I'm looking to alter the color of the top left cell in the DataGridView (above the first RowHeader and to the left of the first Column), but I cannot seem to find the correct method override to accomplish this task.
Does anyone have an idea of the method or if it's possible?
Thanks
Re: DataGridView RowHeaders
If anyone is interested I have found a workaround. You need to override the OnPaint event of the DataGridView and draw or place your control into that X,Y location.
Code:
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
// Draw over the TopLeftHeader.
Rectangle cellBounds = new Rectangle(0, 0, this.RowHeadersWidth, this.ColumnHeadersHeight);
LinearGradientBrush lgb = new LinearGradientBrush(cellBounds, Color.FromArgb(245, 245, 245), Color.FromArgb(220, 220, 220), LinearGradientMode.Vertical);
e.Graphics.FillRectangle(lgb, cellBounds);
}