检测(右)单击标签页标题

时间:2017-11-08 09:05:21

标签: vb.net winforms tabcontrol tabpage

当我右键单击标题页时,我想显示一个contextmenustrip。

enter image description here

但是,我没有找到检测标签页上点击的方法。

有人知道这样做的方法吗?

1 个答案:

答案 0 :(得分:3)

Private Sub tab1_MouseClick(sender As Object, e As MouseEventArgs) Handles tab1.MouseClick

    For i As Integer = 0 To Me.tab1.TabPages.Count - 1
        If Me.tab1.GetTabRect(i).Contains(e.X, e.Y) Then

            If e.Button = MouseButtons.Right Then
                'Do some stuff here Me.ctxTabHeader.Show(e.X, e.Y)
            End If

        End If
    Next

End Sub