嵌套事件第2层不会触发

时间:2014-11-10 16:03:56

标签: vb.net events visual-studio-2013

我遇到了一个似乎无法克服的障碍。我有一个使用mousehover事件的groupbox。在该组框中,在五个标签上有五个点击事件(每个标签一个事件要澄清)。我的问题是:

我觉得mousehover事件正在杀死click事件,因此永远不会让它触发。有没有办法让hoverevent起火一次并停用,直到鼠标离开groupbox区域?

找到以下两个事件的代码:

Private Sub GroupBox1_MouseHover(sender As Object, e As EventArgs) Handles GroupBox1.MouseHover
    If GroupBox1.Height = 18 Then
        GroupBox1.Height = 180
        GroupBox2.Height = 18
        GroupBox3.Height = 18
        GroupBox4.Height = 18
        GroupBox5.Height = 18
        GroupBox1.Top = 12
        GroupBox2.Top = 198
        GroupBox3.Top = 222
        GroupBox4.Top = 246
        GroupBox5.Top = 270
        GroupBox1.Text = "Session 1 (+)"
        GroupBox2.Text = "Session 2 (-)"
        GroupBox3.Text = "Session 3 (-)"
        GroupBox4.Text = "Session 4 (-)"
        GroupBox5.Text = "Session 5 (-)"
    End If
End Sub

Private Sub HTS1S1_Click(sender As Object, e As MouseEventArgs) Handles HTS1S1.Click
    If HTS1S1.Text = 1 Then
        HTS1S1.Text = 0
        ATS1SA.Text = 1
    ElseIf HTS1S1.Text = 0 Then
        HTS1S1.Text = 1
        ATS1SA.Text = 0
    End If
End Sub

任何帮助都将受到高度赞赏 提前致谢

1 个答案:

答案 0 :(得分:0)

我发现了这个问题,来自我身边的业余错误。我再次看了看标签,注意到我禁用了它。背景颜色与禁用控件的颜色相同,因此完全错过了可能性。