如下图:原背景色白色,hover时变灰色,但鼠标移动太快导致部分没能恢复为白色
private void Item_MouseEnter(object sender, EventArgs e)
{
this.BackColor = Color.FromArgb(248, 248, 248);
}
private void Item_MouseLeave(object sender, EventArgs e)
{
//避免鼠标在子控件上时遮挡而触发鼠标离开控件的情况
if (!this.RectangleToScreen(this.ClientRectangle).Contains(MousePosition))
{
this.BackColor = Color.White;
}
}