I have a DataGridViewLinkColumn.How can I make the header(row = -1) as underline and change it's background color?
Solution private void dataGridView_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.RowIndex == -1 && e.ColumnIndex == 2)
{
e.Handled = true;
e.Graphics.FillRectangle(Brushes.cont, e.CellBounds);
StringFormat sf = new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center };
Font f = new Font(e.CellStyle.Font, FontStyle.Underline);
e.Graphics.DrawString(e.Value.ToString(), f, new SolidBrush(e.CellStyle.ForeColor), e.CellBounds, sf);
}
}