int oldRowNumber = -1;
private void c1FlexGrid1_MouseMove(object sender, MouseEventArgs e)
{
// 获取鼠标指向的 Row 对象
int newRowNumber = c1FlexGrid1.MouseRow;
// if 中最后一个条件是必须的,否则颜色刚转换又被恢复了
if (newRowNumber > 0 && newRowNumber < c1FlexGrid1.Rows.Count && newRowNumber != oldRowNumber)
{
c1FlexGrid1.Rows[newRowNumber].StyleNew.BackColor = ColorTranslator.FromHtml("#e9f7f6");
c1FlexGrid1.Rows[newRowNumber].StyleNew.ForeColor = ColorTranslator.FromHtml("#00619d");
c1FlexGrid1.Cursor = Cursors.Hand;
if (oldRowNumber > 0)
{
c1FlexGrid1.Rows[oldRowNumber].StyleNew.BackColor = c1FlexGrid1.BackColor;
c1FlexGrid1.Rows[oldRowNumber].StyleNew.ForeColor = c1FlexGrid1.ForeColor;
}
}
oldRowNumber = newRowNumber;
}