Slow picturebox hover

I'm rather new at Visual Basic and a problem has accrued. The problem I got is that the change of image in the picturebox is slow, to slow to be acceptable.

I've added the pictures to the resources and the event code looks like this:

Private Sub menuplay_hover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuplay.MouseHover
menuplay.Image = Snake.My.Resources.menuplay_hover
End Sub

Private Sub menuplay_hoveroff(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menuplay.MouseLeave
menuplay.Image = Snake.My.Resources.menuplay
End Sub

The original image that is assigned to the picturebox is called "menuplay".
When you hover over the picturebox it takes somewhat long to load the image "menuplay_hover" but when you leave the picturebox the image "menuplay" loads immediately.

I hope you understand my problem, if not I'll try to explain better.

Thanks!


Answer this question

Slow picturebox hover

  • ranger28

    You might try using two separate picture boxes with one on top of the other and where each one has been preloaded with one of the images so that you can simply toggle back and forth between the two by using BringToFront() to save the loading time.

  • Ernesto OLLUSA

    Try mouseenter instead of mousehover
  • Jane Sathyan

    Great it works now! Thansk a lot!

  • Eric H.

    Unfortunately it didn't work. I still have the same delay.

    Thanks!

  • Slow picturebox hover