I am having troubles with setting my user control to automatically resize with the panel where it is created. When user is resizing a main form that contains the user control, the size of this user control does not change at all making for some poor user experience.
So far I tried following:
- Ensure MinimumSize and MaximumSize properties on the user control are set to 0.
- Set AutoSize property on both (1) the user control and (2) the panel where it resides to True
- Set Anchor property on the panel to Top, Bottom, Left, Right
- Set Dock property to Fill for the user control (I did this with the following code)
These attempts had no effect on the behavior of my user control:
CalcUserControl calcControl = new CalcUserControl(CountryId);
calcControl.Dock = DockStyle.Fill;
panelUserCtrl.Controls.Clear();
panelUserCtrl.Controls.Add(calcControl);
Any suggestions would be much appreciated.