dataGridView設置單元格內容的顯示格式CellFormatting
阿新 • • 發佈:2018-10-08
判斷 else pri spa 技術 inf src http private
#region 設置單元格內容的顯示格式 private void dataGridView_main_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { #region 會診方式判斷 int requestType_column_index = 9; if (e.ColumnIndex == requestType_column_index) {string sval = (e.Value ?? "").ToString(); switch (sval) { case "1": e.Value = "視頻"; break; case "2": e.Value = "電話"; break; } } #endregion #region 會診狀態判斷 int status_column_index = 11; if (e.ColumnIndex == status_column_index) { string sval = (e.Value ?? "").ToString(); if (sval == "0") { e.Value = "已申請"; } else if (sval == "1") { e.Value= "已審批"; } else if (sval == "2") { e.Value = "已分診"; } else if (sval == "3") { e.Value = "已報告"; } else if (sval == "4") { e.Value = "已完成"; } else if (sval == "5") { e.Value = "已刪除"; } #endregion } } #endregion
dataGridView設置單元格內容的顯示格式CellFormatting