I am having difficulty getting both the vertical and horizontal scroll bars to behave as desired in my situation. The page in question has multiple sections that can be expanded and collapsed (only one can be expanded at a time). To try and demonstrate the layout of my page I'm going to use nesting and perhaps a silly naming convention to be as clear as possible:
- ucParent
- pnlParent
- pnl1Title
- pnl1
- uc1
- pnl2Title
- pnl2
- uc2
- pnl3Title
- pnl3
- uc3-1
- uc3-2
- uc3-3
- pnlParent
And so on. Now, pnlParent has dock=fill, while the child panels are dock=top. All the pnlXTitle panels have buttons that trigger the expanding/collapsing behavior by setting their respective panels directly underneath to enabled=visible=false.
I'm wanting the horizontal and vertical scroll bars to show up as needed when the window is resized and hiding content, however I am not being successful at eliciting this behavior.
- With ucParent.AutoScroll=false and pnlParent.AutoScroll=true only the vertical scroll bar is present.
- With ucParent.AutoScroll=true and pnlParent.AutoScroll=false neither scrollbar works.
- With both ucParent.AutoScroll=true and pnlParent.AutoScroll=true only the vertical scroll bar is present.
In all the above examples, AutoScroll=false for all the other panels and user controls. From what I've read so far, I fear the dock=top setting may be interfering with the horizontal scroll bar behavior. I can force it to display and work by using AutoScrollMinSize, but the panels are of different sizes making this feel like much more of a hack than a proper solution.
Through my searching I found a good number of previous discussions revolving around Windows Forms and scrollbars, but I didn't find anything specific enough I feel I can confidently determine the necessary direction for my application. I would very much appreciate any information you could share that would shed light on why the scroll bars are not working as desired and how that can be remedied.
Thank you!