2
votes

The mousedown event for the tabcontrol only captures the mouse click made on the tabs on top of the Tabcontrol, not what's added inside the control (The white space).

Is there a way to capture the event of mousedown that's made inside the tabcontrol?

1
try to put another control in the container of the tab, then use its eventBoomer
ah is this really the only way? because I already have a lot of controls inside the container of the tab.l46kok
The TabControl is just the strip of tabs on the top. The rest is the TabPage. Which gets the mouse event.Hans Passant

1 Answers

3
votes

The tabpages inside the tabcontrol are controls on themselves and on which you can catch mouse events. If added from designer, you can add them to a specific tabpage directly

    private void tabPage1_Click(object sender, EventArgs e)
    {

    }

or a more generic approach, by adding an event to all existing tabpages (if the pages are dynamic, you might want to catch tabadded/removed events too)

        foreach(TabPage tp in tabControl1.TabPages)
            tp.Click += new EventHandler(YourClickEventHandler);