I have a DataGridViewLinkColumn.How can I make the header(row = -1) as underline and change it's background color
var WarningsColumn = new DataGridViewLinkColumn
{
Name = @"Warnings",
HeaderText = @"Warnings",
DataPropertyName = @"WarningsCount",
AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells,
ReadOnly = true
};
I think you have to add custom code to a
CellPainting
event handler like this:It looks not good but it can help you get started, I think the default background is better. If so, you just need to call:
e.PaintBackground(e.CellBounds, true);
UPDATE
The custom painting should be applied on DoubleBuffered control. So I think you should create your own custom DataGridView like this (it's just a little more code):