Click here to Skip to main content
15,904,346 members
Please Sign up or sign in to vote.
3.67/5 (3 votes)
See more:
Have a tab control on a winForm and tabPgs are dynamically added at runtime. How do I enable or add (code) for horizontal scrollbar at the bottom of tab control once tabs reach beyond the space on my form? I know that the tab control will display/add the "scroll buttons" but I need a scrollbar.

Any help would be appreciated.

Thanks in advance.

-DA
Posted
Updated 24-Feb-13 10:27am
v2
Comments
CHill60 20-Feb-13 12:02pm    
I suspect that you may need to create a custom control to handle this. I've experimented by putting a tab control onto a panel that has AutoScroll set to True and increasing the size of the tab control each time I add a tab - it looks a bit messy - might have to manually "draw" the borders but it works in principle
d.allen101 20-Feb-13 15:09pm    
thx will try. seems like the best option for now
CHill60 20-Feb-13 18:02pm    
Have just upvoted your question because it has piqued my interest and I'm enjoying the challenge :-) I'm a *expert* googler and couldn't find a solution that way. And it's been fun trying different ways to achieve (what I think) what you're trying to achieve. If you do find a "perfect" solution think about possibly posting it as a CP article ... if I get there before you .... ;-p

1 solution

Workaround: Add an
C#
HScrollBar
to the form. When adding new pages set
C#
TabControl.Maximun = TabControl.TabCount
. Finally on the
C#
HScrollBar_Scroll
event, set
C#
TabControl.SelectedIndex = HScrollBar.Value
. Yours, Rodolfo.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900