Winfrom 表格单元格格式化事件(DataGridView - CellFormatting)
格式化 14,15列将编码显示为编码值
1 this.dgv_prescription.CellFormatting += 2 (object sen, DataGridViewCellFormattingEventArgs ev) => 3 { 4 DataGridView dgv = (DataGridView)sen; 5 if (ev.RowIndex < dgv.Rows.Count - 1) 6 { 7 if (ev.ColumnIndex == 14 || ev.ColumnIndex == 15) 8 { 9 ev.Value = ev.Value.ToString() == "1" ? "是" : "否"; 10 } 11 } 12 };