Reputation: 687
Well, I have a panel that contain some forms. I set panel Dock to Fill because it will be good when window maximized. I set the minimum size of panel too because the contents/forms quite be long to bottom.
Sadly, the scroll bar not shown even I set AutoScroll to True and set AutoScrollMinSize. How to configure this properly?
Let's say I have window height size only 300px but the panel (in window) that contain my forms have height about 600px. I need to always show the scroll bar.
Thanks in advance
Upvotes: 2
Views: 3315
Reputation: 687
Thanks all, I finally figured out what's wrong. I don't need set the MinimumSize of panel
Properties of Panel
Dock: Fill
AutoScroll: true
AutoScrollMinSize: 600px (Height)
It will be automatically force the panel to follow AutoScrollMinSize instead MinimumSize or default Size.
Upvotes: 5
Reputation: 351
Make sure you don't have any child anchord to the right of the panel, as showed in MSDN documantation:
"There is currently a limitation in Windows Forms that prevents all classes derived from ScrollableControl from acting properly when both RightToLeft is enabled and AutoScroll is set to Yes. For example, let's say that you place a control such as Panel—or a container class derived from Panel (such as FlowLayoutPanel or TableLayoutPanel)—on your form. If you set AutoScroll on the container to Yes and then set the Anchor property on one or more of the controls inside of the container to Right, then no scrollbar ever appears. The class derived from ScrollableControl acts as if AutoScroll were set to No. Currently, the only workaround is to nest the ScrollableControl inside another ScrollableControl. For instance, if you need TableLayoutPanel to work in this situation, you can place it inside of a Panel control and set AutoScroll on the Panel to Yes."
Upvotes: 1