dataGridView改变单元格内的样式。

来源:互联网 发布:淘宝店铺怎么换支付宝 编辑:程序博客网 时间:2024/06/10 05:54

所有行: dataGridView1.RowsDefaultCellStyle.Font = new Font("宋体", 9, FontStyle.Strikeout);


dataGridView1.RowsDefaultCellStyle.ForeColor = Color.Blue;


dataGridView1.RowsDefaultCellStyle.BackColor = Color.Red;



选中行:

dataGridView1.SelectedRows[0].DefaultCellStyle.Font = new Font("宋体", 9, FontStyle.Strikeout);


dataGridView1.SelectedRows[0].DefaultCellStyle.ForeColor = Color.Blue;


dataGridView1.SelectedRows[0].DefaultCellStyle.BackColor = Color.Red;

 


原创粉丝点击