Skip to content

Tabcontrol Header Click Event

Richard van Giesen

Asked Dec 6, 2011, 1:16 AM EST1 answer
Share
LinkedInX
Hi

I'm trying to add a click event to a tabpage in a tabcontrol, but only when the user clicks the tab header. This is also includes a click when the tabpage is already selected, so I can't really use SelectedIndexChanged. Although I can set a click event on the tabpage itself, it captures the click whenever I click anywhere on the tabpage, except on the header. It makes me believe there must be a way to create a click event only on the header, but I can't find a way to implement the handler.

Initially, I used an imagelist as well, because I wanted to fire an event when a user clicks on the image in the tabheader, but in this case I couldn't find the right place to add the handler either.

Does anyone know where I have to add my event?

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Never mind, I managed to solve it by adding empty click events to the tabpages, and one big click event to the tabcontrol itself, and by getting the SelectedTab, I could do anything I wanted.
    0