tmighty
tmighty

Reputation: 11389

Detect (right) click on tab page header

I would like to show a contextmenustrip when I right-click a tab header.

enter image description here

However, I didn't find a way to detect a click on the tab header.

Does anybody know a way to do that?

Upvotes: 3

Views: 1101

Answers (1)

tmighty
tmighty

Reputation: 11389

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

Upvotes: 3

Related Questions