private void grdConnectionProperties_CellPainting(object sender, DataGridViewCellPaintingEventArgs e)
{
if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
{
DataGridViewCell cell = grdConnectionProperties.Rows[e.RowIndex].Cells[e.ColumnIndex];
if (cell != null && IsPasswordCell(cell) && cell.Value != null)
{
e.Paint(e.CellBounds, DataGridViewPaintParts.All & ~DataGridViewPaintParts.ContentForeground);
Graphics g = e.Graphics;
g.DrawString(new string('*', cell.Value.ToString().Length), this.Font, new SolidBrush(Color.Black), e.CellBounds);
e.Handled = true;
}
}
}