Reputation: 313
I'de like you to take a look at this code: I have a Button named Button1.
private void button1_MouseHover(object sender, EventArgs e)
{
button1.BackColor = Color.Black;
}
private void button1_MouseLeave(object sender, EventArgs e)
{
button1.BackColor = Color.Blue;
}
This code works but the problem is there is a very small delay. About 1/2 second delay on changing the colors. I've tried the same thing in WPF and there is absolutely no delay in that. Basically I want the Mouse event to fire as quickly as possible.
In what ways can i accomplish that task ? Thank you
Upvotes: 1
Views: 327
Reputation: 11626
Calling button1.Invalidate(false)
will result in redrawing the control within the next frame. Place this line right after your color-changing code and see if it works.
Upvotes: 0
Reputation: 25008
Try using the MouseEnter event rather than MouseHover - the latter is fired 'after a delay' because Windows can't tell that the mouse is hovering unless it has been stationary for a short while.
Upvotes: 5