有没有办法在mousehover事件上更改工具栏按钮的大小?
我尝试了这个但是没有用。
Private Sub tsDriver_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles tsDriver.MouseHover
Dim pt As Point
pt.X = 60
pt.Y = 70
tsDriver.Size = pt
End Sub
我希望有这样的效果,当鼠标悬停在按钮上时,它会变大,当鼠标离开时它将恢复到原来的大小。
答案 0 :(得分:1)
你应该实例化一个大小,这是一个单独的对象。试试这个,它应该有用;
Private Sub tsDriver_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles tsDriver.MouseHover
Dim pt As New System.Drawing.Point
pt.X = 60
pt.Y = 70
tsDriver.Size = New System.Drawing.Size(pt)
End Sub
请注意,MouseHover事件仅在鼠标光标进入控制位置时触发 因此,要使按钮缩小到原始大小,应该对MouseLeave事件进行编码;
Private Sub tsDriver_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles tsDriver.MouseLeave
Dim pt As New System.Drawing.Point
pt.X = 40 ' Original size
pt.Y = 50
tsDriver.Size = New System.Drawing.Size(pt)
End Sub
答案 1 :(得分:0)
仅按钮会调整大小吗?或者其他按钮调整大小也可以吗?
如果是这样,您可以操作工具提示窗口的ImageScalingSize属性
Dim pt2 As Point
pt2.X = 100
pt2.Y = 100
ToolStrip1.ImageScalingSize = pt2
这假设其他按钮也可以增长。