I
iHandler
Guest
The coding works fine in a WinForm, however, is there a way to place this code in a centralize location such as a Global Class, so there is no need to place these coding repeatedly, all over to other forms.
What I am looking for is something like a class
Global.FormatDataGridView.HighlightRow(true); // In case I need this feature, just turn it on
private void datagridview1_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex > 0 && e.ColumnIndex > 0)
this.datagridview1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.LightBlue;
else
return;
}
private void datagridview1_CellMouseLeave(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex > 0 && e.ColumnIndex > 0)
this.datagridview1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.White;
else
return;
}
Continue reading...
What I am looking for is something like a class
Global.FormatDataGridView.HighlightRow(true); // In case I need this feature, just turn it on
private void datagridview1_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex > 0 && e.ColumnIndex > 0)
this.datagridview1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.LightBlue;
else
return;
}
private void datagridview1_CellMouseLeave(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex > 0 && e.ColumnIndex > 0)
this.datagridview1.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.White;
else
return;
}
Continue reading...