标签:
效果:
代码:
/// <summary> /// 格式化数据 /// </summary> private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.ColumnIndex == 3 ) //哪一列 { if (Convert.ToInt32(e.Value) == 1) { e.Value="存在维修记录,双击查看!"; e.CellStyle.ForeColor = Color.Green; } else if(Convert.ToInt32(e.Value) == 0) { e.Value="未创建维修记录!"; e.CellStyle.ForeColor = Color.Red; } else { } } }
WinForm - 格式化DataGridView单元格数据
标签:
原文地址:http://www.cnblogs.com/KTblog/p/5102232.html