void RKcolor()//已经入库存为绿色
{//取行号
int tz = Convert.ToInt32(1);//1入 库存
for (int t = 0; t < this.dataGridView1.Rows.Count; t++)
{
string ttbm = this.dataGridView1.Rows[t].Cells["xmcheck"].Value.ToString();
if(ttbm !="")
{
int dvid = Convert.ToInt32(this.dataGridView1.Rows[t].Cells["xmcheck"].Value);//找编号
if (dvid == tz)//、、编号和交集相等
{
int idext = this.dataGridView1.Rows[t].Index;//找到所在行的索引,然后对应索引进行加色
this.dataGridView1.Rows[idext].DefaultCellStyle.BackColor = Color.BurlyWood;
//默认选中
// dataGridView1.Rows[idext].Cells["xz"].Value = 1;
}
// this.dataGridView1.Rows[t].Cells["xz"].Value = tz;
}
}
}
dataGridView1中某一行为1的标色
1.要找的值为1
int tz = 1;//1
2.循环查询xmcheck中的这个值为dvid
int dvid = Convert.ToInt32(this.dataGridView1.Rows[t].Cells["xmcheck"].Value);//找编号
3.如果相等
if (dvid == tz)//、、编号和交集相等
{
int idext = this.dataGridView1.Rows[t].Index;//找到所在行的索引,然后对应索引进行加色
this.dataGridView1.Rows[idext].DefaultCellStyle.BackColor = Color.BurlyWood;
//默认选中
// dataGridView1.Rows[idext].Cells["xz"].Value = 1;
}