Working with tabcontrol and tabpage

  • Thread starter Thread starter Ed Debrot
  • Start date Start date
E

Ed Debrot

I have a tabcontrol that has several attached tabpage's. Not all of the
tabpages should be accessible at all times. Ideally I'd like to do one of
the following:

- hide those tab pages that should not currently be accessible

OR

- change the font on the tab for the tabpages that are disabled (like gray
them out or something) as a means of user feedback that they're inactive

The problem is that none of this appears possible. Sure, I can catch the
click event on the "disabled" tabs but I want some visual indicator that
they are not currently enabled. Makes sense, right? Anybody come across
this? This seems like pretty basic functionality.

FYI - the Hide(), Visible, and Enabled methods/properties do not satisfy
this requirement. They work, but as it says in MSDN, this poor behavior was
"by design". Why doesn't that line work for me?
 
In order to show / hide tabpages, you must Remove them from the
TabControl and Add them back in.

There are some examples in this group of how to handle the Paint event
yourself for the tab pages in order to change fonts / colour on the
tabs themselves.

This is one of the areas in which the "by design" behaviour of TabPages
is inadequate. Another is the inability to "highlight" the tab text
when there is an ErrorProvider flashing on another page, so there is an
error that the user can't see. In short, TabPages need help; I hope
that they improve in some future version.
 
Back
Top