还是GridView问题请教 我数据库里有一列为1,2,3,4,5,当某个值为1时此行在Gridview中的颜色为红,为2时颜色为绿......请教具体操作及代码.谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 改它的背景颜色就行了第一列for (int i = 0; i < this.dataGridView1.RowCount; i++) { if(this.dataGridView1.Rows[i].Cells[0].Value.ToString().Trim()=="1") this.dataGridView1.Rows[i].Cells[0].Style.BackColor = Color.Red; else if (this.dataGridView1.Rows[i].Cells[0].Value.ToString().Trim() == "2") this.dataGridView1.Rows[i].Cells[0].Style.BackColor = Color.Green; }....... 我想知道该如何改字体颜色...比方在ASP里面:if rs("id")=1 then<tr><td><font color="red">rs("a")</font></td><td><font color="red">rs("b")</font></td><td><font color="red">rs("c")</font></td></tr>end ifif rs("id")=2 then<tr><td><font color="green">rs("a")</font></td><td><font color="green">rs("b")</font></td><td><font color="green">rs("c")</font></td></tr>end if....反正我就想用C#来表达上面的意思吧....谢谢!!!! c# sql 语句换行 送分 分 分 c#问题 【50分】ILIDE# 为什么编译后没法执行啊? 水晶报表怎么传参数呀!老师们帮帮忙! 如何制作IE插件呀 用输入的变量模糊查询 两个grid,其中一个表上实现了字典表的帮定(Combobox),但现在还想实现两个表的主从关系绑定,试了半天,不知该怎么写了? 请求P2P通讯,在公网上 有谁要ORACLE9I全套OCP的电子教材 请问哪里有visual stdio.net下载? C#如何作消息窗口? 窗体如何响应键盘事件?窗体的KEYdown事件不响应呢??
第一列
for (int i = 0; i < this.dataGridView1.RowCount; i++)
{
if(this.dataGridView1.Rows[i].Cells[0].Value.ToString().Trim()=="1")
this.dataGridView1.Rows[i].Cells[0].Style.BackColor = Color.Red;
else if (this.dataGridView1.Rows[i].Cells[0].Value.ToString().Trim() == "2")
this.dataGridView1.Rows[i].Cells[0].Style.BackColor = Color.Green; }.......
if rs("id")=1 then
<tr>
<td>
<font color="red">rs("a")</font>
</td>
<td>
<font color="red">rs("b")</font>
</td>
<td>
<font color="red">rs("c")</font>
</td>
</tr>
end if
if rs("id")=2 then
<tr>
<td>
<font color="green">rs("a")</font>
</td>
<td>
<font color="green">rs("b")</font>
</td>
<td>
<font color="green">rs("c")</font>
</td>
</tr>
end if....
反正我就想用C#来表达上面的意思吧....谢谢!!!!