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     };

 

posted @ 2016-07-20 09:48  程序员老郑  阅读(2655)  评论(0编辑  收藏  举报