Hi,
You can draw the text yourself.
void dataGridView1_Paint(object sender, PaintEventArgs e)
{
//get the column header cell
Rectangle r1 = this.dataGridView1.GetCellDisplayRectangle(0, -1, true);
e.Graphics.FillRectangle(new
SolidBrush(this.dataGridView1.ColumnHeadersDefaultCellStyle.BackColor), r1);
StringFormat format = new StringFormat();
format.Alignment = StringAlignment.Near;
format.LineAlignment = StringAlignment.Center;
//r1.X -= 2;
e.Graphics.DrawString(dataGridView1.Columns[0].HeaderText,
this.dataGridView1.ColumnHeadersDefaultCellStyle.Font,
new SolidBrush(this.dataGridView1.ColumnHeadersDefaultCellStyle.ForeColor),
r1,
format);
}
More information drawing columnHeader:
http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/a44622c0-74e1-463b-97b9-27b87513747e#faq6
http://www.codeproject.com/KB/grid/DataGridView_winforms.aspx
Best regards,
Ling Wang
Please remember to click “Mark as Answer�on the post that helps you, and to click “Unmark as Answer�if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.