DataGridView单元格显示密码

DataGridView单元格显示密码

private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
if (e.ColumnIndex == 1)
{
if (e.Value != null && e.Value.ToString().Length > 0)
{
e.Value = new string('*', e.Value.ToString().Length);
}
}
}

原文地址:https://www.cnblogs.com/wfy680/p/12121407.html