Change DataGridViewRow FontStyle To Bold In CellFormatting Event
Hello,
There was a question raised in the forums on how to change the FontStyle of a DataGridViewRow to Bold in the CellFormatting event. A solution is to set the Font property of a row with a Font object setting it's second parameter to FontStyle.Bold.
There was a question raised in the forums on how to change the FontStyle of a DataGridViewRow to Bold in the CellFormatting event. A solution is to set the Font property of a row with a Font object setting it's second parameter to FontStyle.Bold.
private void EmployeeDTRDataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (EmployeeDTRDataGridView.Columns[e.ColumnIndex].Name == "OnLeave") { if (e.Value != System.DBNull.Value) { if (Convert.ToBoolean(e.Value) == true) { EmployeeDTRDataGridView.Rows[e.RowIndex].DefaultCellStyle.Font = new Font(e.CellStyle.Font, FontStyle.Bold); } } } }
Comments
Post a Comment