private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
{
if (dataGridView1.Columns[e.ColumnIndex].Name.Equals("标准"))
{
DataGridViewCell cell = dataGridView1[e.ColumnIndex, e.RowIndex];
String stringValue = e.Value as string;
if (stringValue == null) return;
if (stringValue.Contains("%") == true)
{
this.dataGridView1.Rows[i].Cells[0].Value = "百分比";
}
else if (stringValue.Contains("$") == true)
{
this.dataGridView1.Rows[i].Cells[0].Value = "价值";
}
}
}
}
{
for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
{
if (dataGridView1.Columns[e.ColumnIndex].Name.Equals("标准"))
{
DataGridViewCell cell = dataGridView1[e.ColumnIndex, e.RowIndex];
String stringValue = e.Value as string;
if (stringValue == null) return;
if (stringValue.Contains("%") == true)
{
this.dataGridView1.Rows[i].Cells[0].Value = "百分比";
}
else if (stringValue.Contains("$") == true)
{
this.dataGridView1.Rows[i].Cells[0].Value = "价值";
}
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货