private void InitializeAndAddPanel()
{
panel.FlowDirection = FlowDirection.TopDown;
panel.Anchor = AnchorStyles.Left | AnchorStyles.Right;
panel.Dock = DockStyle.Fill;
panel.AutoSize = false;
panel.AutoScroll = true;
Controls.Add(panel);
}
private void AdjustFormAndPanelContentsSize()
{
SetWidthForAllControls(panel.Controls);
panel.Height = Math.Min(MaxHeight, accumulatedControlsHeight);
Height = Math.Min(MaxHeight, accumulatedControlsHeight);
Width = Math.Max(Width, maxControlWidth);
}
I call the first method first and then the 2nd method in the init method
private void InitializeAndAddPanel()
{
panel.FlowDirection = FlowDirection.TopDown;
panel.Anchor = AnchorStyles.Left | AnchorStyles.Right;
panel.Dock = DockStyle.Fill;
panel.AutoSize = false;
panel.AutoScroll = true;
Controls.Add(panel);
}
private void AdjustFormAndPanelContentsSize()
{
SetWidthForAllControls(panel.Controls);
panel.Height = Math.Min(MaxHeight, accumulatedControlsHeight);
Height = Math.Min(MaxHeight, accumulatedControlsHeight);
Width = Math.Max(Width, maxControlWidth);
}
I call the first method first and then the 2nd method in the init method