避免将 mouseHover 和 mouseLeave 用于放置在同一个列表框中的按钮

Avoid mouseHover and mouseLeave for button placed inside the same Listbox

我试图显示放置在列表框上的按钮(类似于 acrobat reader 工具箱):当用户将鼠标移动到列表框内时,按钮会出现,并且当用户离开列表框区域时它们必须隐藏.问题是:当我将鼠标移到列表框上时,按钮会出现,但是当我尝试单击它时,程序将此移动检测为 ListBox_MouseLeave 并隐藏按钮!...这就是逻辑(鼠标现在是在按钮上)但是...

Private Sub ListBox3_MouseHover(sender As Object, e As MouseEventArgs) Handles ListBox3.MouseHover
    Button6.Visible = True
End Sub

Private Sub ListBox3_MouseLeave(sender As Object, e As EventArgs) Handles ListBox3.MouseLeave
    Button6.Visible = False
End Sub

如何避免mouse_leave指令,让按钮可见使用?

将隐藏代码移动到鼠标悬停窗体。

Private Sub Form4_MouseHover(sender As Object, e As EventArgs) Handles Me.MouseHover
        Button1.Visible = False
    End Sub

    Private Sub ListBox1_MouseEnter(sender As Object, e As EventArgs) Handles ListBox1.MouseEnter
        Button1.Visible = True
    End Sub