我正在使用数据GridView,其中我生动地制作了一个图象栏,我希望在这一栏中按以下条件淡化被动和失败的形象:
数据:新数据
img.Name = "img";
img.HeaderText = "Image Column";
dataGridView1.DataSource = dt;
dataGridView1.Columns.Add(img);
int number_of_rows = dataGridView1.RowCount;
for (int i = 0; i < (number_of_rows - 1); i++)
{
if (dataGridView1.Rows[i].Cells[2].Value.ToString() == "Pass")
{
Image image = global::Instore.Properties.Resources.pass;
img.Image = image;
dataGridView1.Rows[i].Cells["img"].Value = image;
}
else if (dataGridView1.Rows[i].Cells[2].Value.ToString() == "Fail")
{
Image image2 = global::Instore.Properties.Resources.fail;
img.Image = image2;
dataGridView1.Rows[i].Cells["img"].Value = image2;
}
}
I have attach the code when I am running it its showing Pass.png in all the rows whereas it should show fail image in some of the rows..
愿帮助......
Thanks Sneha