Hiding the panel should make the controls below move up and resize the form

Well, that makes me a little nut at this moment. Time to ask the crowd:

I have a form consisting of two vertical "halves" created by SplitContainer. At the bottom of the half panel / SplitContainer ... I have:

  • The set of fields / controls to fill in by the user, contained in the panel.

  • Below is a panel containing buttons for "submit", "cancel" ... and "show / hide". This show / hide is intended to show / hide the panel that I just described in step 1 above.

I want this to happen: when the user clicks “hide” the control panel, these controls disappear not only, but also:

  • The panel containing the submit, cancel, and show / hide buttons moves up (so we don’t have this big gap where the once hidden panel was).
  • The shape itself changes vertically to compensate for the hidden panel and the fact that we moved the lower controls up.

I have no problem showing / hiding the control panel / fields. But I can’t figure out how to complete the other two tasks. I tried various combinations of AutoSize , AutoSizeMode and Dock options.

Any suggestions?

+5
source share
1 answer

If you place all your controls in the FlowLayoutPanel , where the children are located vertically, then hiding some controls should make the "lower" controls move up page

You may still need to write code to resize the form itself after the additional content has been hidden or before it is shown.

+6
source

Source: https://habr.com/ru/post/1239803/


All Articles