110,571
社区成员
发帖
与我相关
我的任务
分享
//DataGridView CellFormatting 事件
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (this.dataGridView1.Columns[e.ColumnIndex].Name=="要显示为*的列名" && e.Value!=null && e.Value.ToString().Length>0 )
{
e.Value = new string('*',e.Value.ToString().Length);
}
}
//DataGridView CellFormatting 事件
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.ColumnIndex==0 && e.Value!=null && e.Value.ToString().Length>0 )
{
e.Value = new string('*',e.Value.ToString().Length);
}
}