datagridview相关? 如何使得缺发这列中!=0的项变为红色字体,比如说:第二行 GPS 缺发4 我如何让其显示为红色,然后点击它,在datagridview空间下texbox中显示出来? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 if (this.dataGrid.Rows[i].Cells[j] ... 判断是否!=0) this.dataGrid.Rows[i].Cells[j].Style.ForeColor = Color.Red;//设置字体颜色 把文字放进textbox中,设置样式,点击后将样式还原 dataGridView1.CellFormatting +=(s,e)=> { int i= int.Parse(e.Value.ToString()); if (i!=0) { e.CellStyle.ForeColor = Color.Red; } }; 我已经按照你们的提示写出如下代码: for (int row = 0; row < QueryHW_DB.RowCount; row++) for (int column = 0; column < QueryHW_DB.ColumnCount; column++) //MessageBox.Show ("值是:",QueryHW_DB.Rows[3].Cells[3].Value.ToString ()); if (Convert.ToInt16 ( QueryHW_DB.Rows[row].Cells[column].Value) !=0) this.QueryHW_DB.Rows[row].Cells[column].Style.ForeColor = Color.Red;但是有个地方 if (Convert.ToInt16 ( QueryHW_DB.Rows[row].Cells[column].Value) !=0)还是报错? this.dataGridView1.Rows[i].Cells[validateRows[j]["COLUMN_NAME"].ToString()].Style.BackColor = Color.Red; C#读写串口数据,读不到 HttpWebRequest Post的结果与在IE上点击POST的结果不一样,为什么? socket c#调用带许可证lic的OCX问题 QQ接口如何实现 如何判断日期串是否正确,刚研究出来的 VS.net出问题了!救命 我该如何选择编程语言? 请问可以只遍厉treeview的有限层节点吗? C#如何控制音量? c#windows form WPF Image数据模板帮定问题。
this.dataGrid.Rows[i].Cells[j].Style.ForeColor = Color.Red;//设置字体颜色
{
int i= int.Parse(e.Value.ToString());
if (i!=0)
{
e.CellStyle.ForeColor = Color.Red;
}
};
for (int row = 0; row < QueryHW_DB.RowCount; row++)
for (int column = 0; column < QueryHW_DB.ColumnCount; column++)
//MessageBox.Show ("值是:",QueryHW_DB.Rows[3].Cells[3].Value.ToString ());
if (Convert.ToInt16 ( QueryHW_DB.Rows[row].Cells[column].Value) !=0)
this.QueryHW_DB.Rows[row].Cells[column].Style.ForeColor = Color.Red;
但是有个地方 if (Convert.ToInt16 ( QueryHW_DB.Rows[row].Cells[column].Value) !=0)还是报错?
this.dataGridView1.Rows[i].Cells[validateRows[j]["COLUMN_NAME"].ToString()].Style.BackColor = Color.Red;