I am working on a project which required header text to be in the center, and when click the header it will do the sorting. But the problem is, there is a sorting arrow icon, even when its not showing it push the text to the left. What i want to achieve is
-removing the sorting arrow and put the text to the center but still keep the sorting function
p/s: i tried handle cell event paint and repaint everything in headercell except for .contentbackground the arrow gone but the text is still pushed to the left. here is the code:
void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.RowIndex == -1)
{
e.Paint(e.CellBounds, DataGridViewPaintParts.All &~DataGridViewPaintParts.ContentBackground);
e.Handled = true;
}
}
-keep the sorting arrow but always show it
i am working with vb .net but code in c# is fine
how the header is right now
how i want the header to look like
thank you very much


