winfrom里面datagrid更换行颜色的问题 winfrom里面的datagrid绑定数据后,想设置第一行数据字体颜色为红色,如何设置呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 for (int i = 0; i < dt.Columns.Count; i++) { this.dataGridView1.Rows[0].Cells[i].Style.BackColor = Color.Red; } dt是this.dataGridView1.DataSource = dt; DataGridViewCellStyle dcs = new DataGridViewCellStyle(); dcs.BackColor = Color.Red; this.dataGridView1.Rows[0].DefaultCellStyle = dcs; LS的对,不过是改的是背景颜色,字体颜色为红色则为: DataGridViewCellStyle dcs = new DataGridViewCellStyle(); //dcs.BackColor = Color.Red;//背景颜色 dcs.ForeColor = Color.Red;//字体颜色 this.dataGridView1.Rows[0].DefaultCellStyle = dcs; 可以参考这里,一些常见的问题都能在这里找到答案http://www.syncfusion.com/FAQ/windowsforms/faq_c44c.aspx 咨询c# 发完邮件之后获取参数以及释放资源的问题? TreeView问题!!急! 多线程问题! webbrowse刷新网页的问题 ====奇怪的问题,.NetRemoting在Console下正常,移植到Windows服务就不正常了==== C#编写的DLL如何回调调用自身的C#主程序中的方法? 各位搞C#的来看看。帮帮忙。 WinForm程序中,DataGrid在显示出DataTable数据后,怎样改变列的显示顺序及列的可见性? 在.net中进行存储过程调试时,为何不出现黄色小箭头 安装vs.net出现的问题 这个控件的属性真奇怪 求救xml读取的问题
{
this.dataGridView1.Rows[0].Cells[i].Style.BackColor = Color.Red;
}
DataGridViewCellStyle dcs = new DataGridViewCellStyle();
dcs.BackColor = Color.Red;
this.dataGridView1.Rows[0].DefaultCellStyle = dcs;
字体颜色为红色则为:
DataGridViewCellStyle dcs = new DataGridViewCellStyle();
//dcs.BackColor = Color.Red;//背景颜色
dcs.ForeColor = Color.Red;//字体颜色
this.dataGridView1.Rows[0].DefaultCellStyle = dcs;
http://www.syncfusion.com/FAQ/windowsforms/faq_c44c.aspx