[转载]winform中改变DataGridview的列标题字体颜色

时间:2021-08-09 14:44:51

http://jclhy.bokee.com/viewdiary.41216892.html

DataGridViewCellStyle style = new DataGridViewCellStyle();
            style.ForeColor = Color.Red;
            foreach (DataGridViewColumn col in this.dataGridView1.Columns)
            {
                col.HeaderCell.Style = style;
            }
            this.dataGridView1.EnableHeadersVisualStyles = false;  //<----