#region 绘制 private void dataGridView_main_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e) { int status_column_index = 14;//会诊状态所在列 DataGridViewRow row = dataGridView_main.Rows[e.RowIndex];//获取行 DataGridViewCell cell = row.Cells[15];//按钮所在单元格 string status = (row.Cells[status_column_index]).Value.ToString();//每行中的状态所在列 if (status == "1" && cell.GetType() == typeof(DataGridViewButtonCell) && cell.Style.NullValue.ToString() != "报告")//当每行中的状态列不为4时就把此行中的审核按钮替换为文本单元格 { cell.Style.NullValue = "分诊"; } if (status == "3" && cell.GetType() == typeof(DataGridViewButtonCell) && cell.Style.NullValue.ToString() != "审核")//当每行中的状态列不为4时就把此行中的审核按钮替换为文本单元格 { cell.Style.NullValue = "重新分诊"; } } #endregion