"Diogo Alves - Software Developer"
<Di*************************@discussions.microsoft .com> wrote in message
news:D5**********************************@microsof t.com...
Hi,
I am using VS 2005 and I want to know if it is possible to override the
onPaint() method of the header of the datagrid columns
and if it is possible how can I do it?
Thanks a lot for your attention
Handle the CellPainting event. RowIndex will be -1 for row headers and
ColumnIndex will be -1 for column headers. The following example just paints
all header cells in solid red.
private void itemDataGridView_CellPainting(object sender,
DataGridViewCellPaintingEventArgs e)
{
if (e.RowIndex < 0 || e.ColumnIndex < 0)
{
e.Graphics.FillRectangle(Brushes.Red, e.CellBounds);
e.Handled = true;
}
}
Chris Jobson