//行表头和列表头文字颜色
dataGridView1.ColumnHeadersDefaultCellStyle.BackColor = Color.DarkSlateGray;
dataGridView1.RowHeadersDefaultCellStyle.BackColor = Color.DarkSlateGray;
//行表头和列表头文字颜色
dataGridView1.ColumnHeadersDefaultCellStyle.ForeColor = Color.Cyan;
dataGridView1.ColumnHeadersDefaultCellStyle.Font = new Font("楷体", 12, FontStyle.Bold);
dataGridView1.RowHeadersDefaultCellStyle.ForeColor = Color.Cyan;
dataGridView1.RowHeadersDefaultCellStyle.Font = new Font("楷体", 12, FontStyle.Bold);
//表格背景色
dataGridView1.DefaultCellStyle.BackColor = Color.DarkSlateGray;
dataGridView1.DefaultCellStyle.SelectionBackColor = Color.Teal;
//表格文字样式
dataGridView1.RowsDefaultCellStyle.Font = new Font("楷体", 12, FontStyle.Bold);
dataGridView1.RowsDefaultCellStyle.ForeColor = Color.Cyan;
dataGridView1.DefaultCellStyle.SelectionForeColor = Color.Yellow;
dataGridView1.EnableHeadersVisualStyles = false;
C# DataGridView设置背景颜色、文字颜色及文字样式
最新推荐文章于 2024-08-02 14:12:41 发布
这篇博客详细介绍了如何使用C#编程语言修改Windows Forms应用程序中DataGridView控件的样式。内容包括设置行表头和列表头的背景色与前景色,字体样式,表格的背景色和选中状态的颜色,以及文字样式等,旨在提升界面的视觉效果和用户体验。
摘要由CSDN通过智能技术生成