Hi everyone,
I hope you can help with this one - I'm having a really hard time with the FlowLayoutPanel.
I have a Winforms app with a FLP(FlowLayoutPanel) with one child control - a tabControl(with a webBrowser in it). The form also has a TableLayoutPanel docked on top, and another TableLayoutPanel docked at the bottom. So my intention is to fill the space between these TLP's with the FlowLayoutPanel. All controls are added to the form in design view.
What I need - when I resize the form, the FLP should resize nicely with it, filling the form, and the tabControl should fill the FLP too.
The form is set to run maximized, so a first resize happens by default when I run the app - at that point, the FLP and its control do not resize unless I tel them specifically to do so, in the Form_Layout event handler.
The problem is that no matter what combination of Size changes, Anchors, Docks I try in that event handler, always the top or bottom part of the tabControl is out of the form area and I can't see the full scroll bar of the webbrowser in it; so the tab control is not properly docked inside the FLP(or the FLP is not docked in the form), even if I tell it to be. Here is the Form_layout code:
private void MyForm_Layout(object sender, LayoutEventArgs e)
{
//resize FLP
pnlMainFlowLayout.Size = this.Size - new Size(15, 0);
pnlMainFlowLayout.Dock = DockStyle.Fill;
pnlMainFlowLayout.BringToFront();
//resize child control of FLP
tabControl.Size = pnlMainFlowLayout.Size;
tabControl.BringToFront();
}
I really need to understand the FlowLayoutPanel's resizing behaviour. Thank you for any idea in advance.
Best regards,
/Andrei