Sorry for my English writing I am new with VB.Net. I have a button that sets an image background as picture using the Mouse Hover and Mouse Leave to change the image . The Problem is that it seem slow when loading the images after the event. Is there any way to improve the performance?
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button1.BackgroundImage = My.Resources._1
End Sub
Private Sub Button1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseHover
Button1.BackgroundImage = My.Resources._2
End Sub
Private Sub Button1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseLeave
Button1.BackgroundImage = My.Resources._1
End Sub
Its not that the image is slow to load but rather the default time it needs to fire the MouseHover Event here is more info on that mousehovertime it seem like it can only be set system wide via a API though.
A alternative would be to use MouseEnter instead of MouseHover
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Button1.BackgroundImage = My.Resources._1
End Sub
'use a MouseEnter event instead
Private Sub Button1_MouseEnter(sender As Object, e As EventArgs) Handles Button1.MouseEnter
Button1.BackgroundImage = My.Resources._2
End Sub
Private Sub Button1_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.MouseLeave
Button1.BackgroundImage = My.Resources._1
End Sub