如题。。。
------解决方案--------------------------------------------------------
private void gv_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex != -1)
{
object prevIndex = gv.Tag;
if (prevIndex == null
------解决方案--------------------------------------------------------
!prevIndex.Equals(e.RowIndex))
{
gv.Tag = e.RowIndex;
gv.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.Red;
gv.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Blue;
}
}
}
private void gv_CellMouseLeave(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex != -1)
{
gv.Rows[e.RowIndex].DefaultCellStyle.BackColor = Color.White;
gv.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.FromArgb(0, 64, 64);
}
}