注册 DataGridView 的 CellFormatting 事件,事件方法如下
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
    if (e.ColumnIndex == 性别列编号)
    {
        e.Value = (int)e.Value > 0 ? "男" : "女";
        e.FormattingApplied = true;
    }
}

解决方案 »

  1.   

    private void dgvPatientDocInfo_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
            {
                DataGridViewRow row = this.dgvPatientDocInfo.Rows[e.RowIndex];
                if (e.ColumnIndex == 2)
               {
                    if (row != null)
                    {
                       e.value=row.Cells["sex"].Value.ToString()=="1"?"男":"女";
    }
    }
    }
      

  2.   

    CellFormatting 总是触发呢,怎么办,改了的值一会儿就给变回去了!