tags:

views:

337

answers:

1

hi,

I'm looking for a function which get for input tabcontrol and tabpage index and will return if the tabPage header is shown or not (in case that there are extra pages and scrollbars appear, some of tabPages headers can be disappeared).

does someone have a code for it?

A: 

check the following code works on winForms, you can increase or decrease the scrollbarwidth variable to fit your opinion on how much size you will consider the page shown or not.

 private bool TabPageShown(TabControl tabCtrl, int tabIndex)
        {
             Rectangle rct = tabCtrl.GetTabRect(tabIndex);
             int scrollBarWidth = 24;
             if (rct.X - scrollBarWidth < tabCtrl.Width)
             {
                 return true;
             }
             else
             {
                 return false;
             }
        }
Wael Dalloul