赞
踩
在控件DataGridView的RowPrePaint事件:
- private void DGV_staffList_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
- {
-
- //int status = Convert.ToInt32(this.DGV_staffList.Rows[e.RowIndex].Cells[24].Value);
- //ForeColor = Color.Red;//将前景色设置为红色,即字体颜色设置为红色
- //switch (status)
- //{
- // case 2:
- // this.DGV_staffList.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Red;
- // break;
- // case 1:
- // this.DGV_staffList.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Red;
- // break;
- // case 0:
- // this.DGV_staffList.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Red;
- // break;
- //}
- for (int i = 0; i < this.DGV_staffList.Rows.Count; i++)
- {
- if (this.DGV_staffList.Rows[i].Cells["Column14"].Value.ToString() == "1")
- {
- this.DGV_staffList.Rows[i].DefaultCellStyle.ForeColor = Color.Red;
- }
-
- }
-
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。