Winfrom 表格单元格格式化事件(DataGridView

格式化 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     };
原文地址:https://www.cnblogs.com/cbread/p/5687175.html