1

I can't get out from my problem.

I have a panel with multiple controls and I want them be as large as the panel width. These controls can be extended and collapsed by a clicking a button, showing or not some controls they contain. So the I've set Dockstyle.Fill = true for the panel.

The problem is: when I click for extending one of this controls, the scroll bar is showed (and it's ok) but it automatically cause a resize of the width of the controls in the panel and it is really bad looking and slow, because I have a lot of controls!!!

I have tried adding Padding and Margin to the panel, but with no result.

I have tried making a first panel where to put the controls with a fixed width less 40px (more than the size of the scrollbar) and a fixed height with Dockstyle.Fill = false and then putting this first panel inside a parent panel with Dockstyle.Fill = true, but with no result. The scrollbar doesn't show itself when I click for extending one control.

The following one should work (i'm working on it): the panel should have Dockstyle.Fill = none and when I click to extend or collpase the control I should also adjust the height of the panel (panel's height = heights' sum of all elements visibile in the panel)

FrancescoN
  • 2,146
  • 12
  • 34
  • 45
  • How do you feel about always showing the scroll bars? This answer may help you: https://stackoverflow.com/questions/8690643/how-to-force-vertical-scrollbar-always-be-visible-from-autoscroll-in-winforms – Mathew Bollington Nov 12 '18 at 14:50
  • Hi Mathew, thanks for the help. But that will be the last choice if I couldn't get through this problem. – FrancescoN Nov 13 '18 at 08:50

0 Answers0