Detecting mouse clicks in the "empty" area of a WinForms TabControl

O

\(O\)enone

I've added a TabControl to my WinForms app, and added a couple of tabs to
the control.

The result is that the top strip of the TabControl contains the two tabs,
and then to the right of them is an empty area, above the tab content:


/ Tab 1 caption \ / Tab 2 caption \ XXXX empty space XXXX


I should stress that the empty space is within the bounds of the TabControl,
but there are no tab headers there to be clicked on. This is the space that
would be filled with the header for the third tab if I were to add one.

(I hope that makes sense!)

If I click in the empty space, no mouse events are fired by the TabControl.
This is a nuisance as I need to know that the user has clicked there. I get
mouse events when the user clicks on one of the tab headers, but not the
empty area.

Is there some way I can obtain mouse clicks for this area of the control?
 
F

Family Tree Mike

That area is not part of the control but rather the form (or other control
like a panel) behind it. The easiest way to handle this is probably dock a
tab control in a panel and handle the panels OnMouseClick event as you would
want to handle it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top