日期:2014-05-17 浏览次数:21070 次
void gridview_CellMouseEnter(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) DoWhatYouWant(); }
------解决方案--------------------
你说的 索引超出范围问题这样解决:
private void dataGridView1_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{
dataGridView1.Rows[e.RowIndex -1].Cells[e.ColumnIndex].Style.BackColor = Color.Red;
}