I am trying to place a panel that I want to have multiple textboxes inside of. I want this panel to fit inside the form and the panel to have a scrollbar. I have autoscroll on and its working as intended, but I want to be able to add controls below the size of the panel. Is there a way I can "full screen" the panel and place items in it or even make the scrollbar a set length instead of just the amount needed to fit the contents. I want to be able to place things underneath what I have there.
Dragging items onto the panel doesn't allow enough room to make things tidy
CodePudding user response:
As an option, you can set the AutoScrollMinSize, in your case, the height of it to a larger value like 1000 temporarily, which sets the virtual (Scrillable) height of the control to 1000. The property determines the minimum size of scrollable area.
As another option, you can AutoScrollMargin, in your case, the height of it, to something like 500 temporarily, which provides an extra 500 pixels space at bottom of the panel. The property determines the minimum margin that should be between the edge of the child control and the edge of the scrollable control.
Then when you are done with the design, just right click on the property and Reset the value of it, to let the control calculate the scroll size.
And I assume you are aware of some obvious workarounds like:
- Design the form (including the panel) in a larger size, setting proper dock and and anchor properties for controls, later set the size of form to desired size at run-time, or at design time (after you are done with the initial designs).
- Or another workaround, could be just dropping the controls in the panel, and then selecting them and moving them using arrow keys.