رنگی شدن سلول های DataGridView با حرکت ماوس بر روی آنها
برای رنگی شدن سلول های DataGridView با حرکت ماوس بر روی آنها کافیست که در رویدادهای CellMouseEnter و CellMouseLeave آن کدهای زیر را بنویسید :
private void dataGridView1_CellMouseEnter(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) //column header / row headers { return; } this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.LightBlue; } private void dataGridView1_CellMouseLeave(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) //column header / row headers { return; } this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.White; }