当鼠标悬停在按钮上时更改图像

问题描述:

我只想问。如果鼠标悬停在按钮上,那么代码将会是什么,然后用户窗体中的图像会立即发生变化。当鼠标悬停在按钮上时更改图像

这是Excel VBA。

请看下面的图像。

[enter image description here[1]

谢谢和问候,

你应该实现你的按钮的mouseMove事件。

Private Sub YourButtonName_MouseMove(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single) 
    'your Code Here 

End Sub 

但要小心这就是所谓的每次移动鼠标按钮的时间。所以你应该检查你是否绘制图像。

+0

嗨巴斯洛,谢谢你我添加image1.picture = loadpicture(picpath) – Tramyer