N
nolan.glore
I am using TableLayoutPanel to dynamically add and remove Controls to
my form. The TableLayoutPanel is set to auto scroll. As Controls are
added the DisplayRectangle height grows but when the Controls are
removed the DisplayRectangle doesn't shrink. This causes extra space
on the bottom of the from. Any suggestions on how to fix this.
Here is the code that sets up the TableLayoutPanel:
m_pnlForm = new TableLayoutPanel();
m_pnlForm.Dock = DockStyl.Fill;
m_pnlForm.AutoScroll = true;
m_pnlForm.Parent = this;
Controls are added by setting it's parent to the TableLayoutPanel
controlToAdd.Parent = m_pnlForm;
Controls are removed by clicking a button that is on the Control to
remove
// here the parent is the TableLayoutPanel
Control parent = controlToRemove.Parent;
parent.Controls.Remove(controlToRemove);
Any help would be much appreciated.
my form. The TableLayoutPanel is set to auto scroll. As Controls are
added the DisplayRectangle height grows but when the Controls are
removed the DisplayRectangle doesn't shrink. This causes extra space
on the bottom of the from. Any suggestions on how to fix this.
Here is the code that sets up the TableLayoutPanel:
m_pnlForm = new TableLayoutPanel();
m_pnlForm.Dock = DockStyl.Fill;
m_pnlForm.AutoScroll = true;
m_pnlForm.Parent = this;
Controls are added by setting it's parent to the TableLayoutPanel
controlToAdd.Parent = m_pnlForm;
Controls are removed by clicking a button that is on the Control to
remove
// here the parent is the TableLayoutPanel
Control parent = controlToRemove.Parent;
parent.Controls.Remove(controlToRemove);
Any help would be much appreciated.