I got a picture box that got an original image in my program. When i hover with my mouse over it it changes picture to another picture and when i leave it changes back. But.. There is such a delay to change to the right picture if i hover over it or not. It takes like 1 second before it changes, What should i change to improve the speed of the change? This is the code i am using at the moment:
我有一个在我的程序中获得原始图像的图片框。当我用鼠标悬停在它上面时,它将图片更改为另一张图片,当我离开时它会改变回来。但是......如果我将鼠标悬停在它上面,就会有这样的延迟改变到正确的画面。在变化之前需要1秒钟,我应该改变什么以提高变化的速度?这是我目前使用的代码:
private void pictureBox1_MouseHover(object sender, EventArgs e)
{
pictureBox1.Image = ABC_Bok.Properties.Resources.BokVänsterhörn_1;
}
private void pictureBox1_MouseLeave(object sender, EventArgs e)
{
pictureBox1.Image = ABC_Bok.Properties.Resources.BokVänsterhörnet;
}
1 个解决方案
#1
2
This is the third time today that I've seen this issue. MouseHover
is raised when the mouse pointer STOPS OVER a control. If you want something to happen as soon as the mouse pointer goes over the control then you want MouseEnter
, just as you're using MouseLeave
for the change back again.
这是我今天第三次看到这个问题。当鼠标指针STOPS OVER一个控件时,会引发MouseHover。如果你想在鼠标指针越过控件时发生某些事情,那么你需要MouseEnter,就像你再次使用MouseLeave进行更改一样。
#1
2
This is the third time today that I've seen this issue. MouseHover
is raised when the mouse pointer STOPS OVER a control. If you want something to happen as soon as the mouse pointer goes over the control then you want MouseEnter
, just as you're using MouseLeave
for the change back again.
这是我今天第三次看到这个问题。当鼠标指针STOPS OVER一个控件时,会引发MouseHover。如果你想在鼠标指针越过控件时发生某些事情,那么你需要MouseEnter,就像你再次使用MouseLeave进行更改一样。