6
votes

OK, this is driving me a bit nuts at this point. Time to ask the crowd:

I have a form that consists of: two vertical "halves" created by a SplitContainer. Inside the bottom "half" / SplitContainer panel... I have:

  1. A set of fields/controls for the user to fill out, contained within a panel.

  2. Below that, a panel containing buttons for "submit", "cancel"...and one that's "show/hide". This "show/hide" is intended to show/hide the panel I just described in point 1 above.

What I want to happen is: when the user clicks to "hide" the panel of controls, not only do those controls vanish, but also:

  • The panel containing the submit, cancel and show/hide buttons moves up (so that we don't have this big blank space where the now-hidden panel once was).
  • The form resizes itself vertically so as to make up for the now-hidden panel and the fact that we've moved the bottom controls upwards.

I have no problem getting the panel of controls/fields to show/hide. But I can't seem to figure out how to accomplish the other two tasks. I've tried various combinations of AutoSize, AutoSizeMode, and Dock options.

Any suggestions?

1
Start us off with some pictures and some code?KDecker
My suggestions: include 2 screenshots - before and after "hide"; include relevant designer codeASh

1 Answers

6
votes

If you put all your controls into a FlowLayoutPanel where the children are arranged vertically, then hiding some controls should cause the "lower" controls to move up the page.

You might still need to write some code to resize the form itself once the optional content has been hidden or before it's shown.