I'm trying to have a form autosize when a user clicks on a Link Label. When the Link Label is clicked, I want the form to expand slightly, and show a tab control that I've created. I can't figure out how to use the this.autosize feature correctly for this though. Can someone give me a hand? Thanks
edit> Also, How can I keep controls at the bottom of my form and have them move when the tab_control is visible? E.g., I need to have an OK, and Cancel button at the bottom. How can I make them "float" as the main form grows and shrinks?
I need to have an OK, and Cancel button at the bottom. How can I make them "float" as the main form grows and shrinks?
OK. Try this.
Drop the OK and Cancel buttons (and anything else you need below the TabControl) in to a Panel and put this after the TabControl in the FlowLayoutPanel.
The FlowLayoutPanel now has two items in it (a TabControl and a Panel).
If FlowLayoutPanel.FlowDirection = TopDown then the TabControl should be above the Panel.
When the TabControl.Visible = false the FlowLayoutPanel pulls the Panel to the top and resize, this in turn causes the form to resize.
When the TabControl.Visible = true the FlowLayoutPanel pushes the Panel to the bottom to make room for the TabControl and resize, this in turn causes the form to resize.
Excellent. Thanks. So how do I use that padding control?
The Margin property is used by the designer to stop controls bumping in to each other when snapping. It is also used by Forms during AutoSize to stop the edges from getting too close to controls and by FlowLayoutPanels to stop the controls from getting too close to each other.
The Padding property is used by container controls (such as Forms and Panels) to keep the inside edge of the container free.
Welp, it's not working quite right.
If you are still having trouble post your code and if possible, the form/panel settings.
Set the Anchor property of controls at the bottom of the form to anchor at Bottom/Left instead of Top/Left then, as well as hiding the TabContol, manually resize the form to a known fixed size. The controls anchored at the bottom will move up/down as the form shriks/grows.