S
Steve Richter
I have a form.
In the Form is a MenuStrip and a FlowLayoutPanel.
In the FlowLayoutPanel is a ListBox.
The FlowLayoutPanel is set to DockStyle.Fill.
The ListBox is set to AnchorStyles.Left | AnchorStyles.Right
I am able to verify that the FlowLayoutPanel grows in size as the form
is widened. But the ListBox stays the same size. It does not anchor
to the left and right.
When I place the ListBox directly in the Form and drop the
FlowLayoutPanel and the MenuStrip the ListBox does widen as the form
is widened.
How do I get the ListBox in the FlowLayoutPanel to increase in size as
the FlowLayoutPanel is widened?
thanks,
mFlow = new FlowLayoutPanel();
mFlow.Parent = this;
mFlow.AutoSize = true;
mFlow.Dock = DockStyle.Fill;
mMenu = new MenuStrip();
mMenu.Parent = this;
ToolStripMenuItem item =
(ToolStripMenuItem)mMenu.Items.Add("&Commands", null,
CommandsOnClick);
item = (ToolStripMenuItem)mMenu.Items.Add("FlowSize", null,
FlowSizeOnClick);
mListBox1 = new ListBox();
mListBox1.Parent = mFlow;
mListBox1.Size = mFlow.ClientSize;
mListBox1.Location = new Point(0, 0);
mListBox1.Anchor = AnchorStyles.Right | AnchorStyles.Left ;
In the Form is a MenuStrip and a FlowLayoutPanel.
In the FlowLayoutPanel is a ListBox.
The FlowLayoutPanel is set to DockStyle.Fill.
The ListBox is set to AnchorStyles.Left | AnchorStyles.Right
I am able to verify that the FlowLayoutPanel grows in size as the form
is widened. But the ListBox stays the same size. It does not anchor
to the left and right.
When I place the ListBox directly in the Form and drop the
FlowLayoutPanel and the MenuStrip the ListBox does widen as the form
is widened.
How do I get the ListBox in the FlowLayoutPanel to increase in size as
the FlowLayoutPanel is widened?
thanks,
mFlow = new FlowLayoutPanel();
mFlow.Parent = this;
mFlow.AutoSize = true;
mFlow.Dock = DockStyle.Fill;
mMenu = new MenuStrip();
mMenu.Parent = this;
ToolStripMenuItem item =
(ToolStripMenuItem)mMenu.Items.Add("&Commands", null,
CommandsOnClick);
item = (ToolStripMenuItem)mMenu.Items.Add("FlowSize", null,
FlowSizeOnClick);
mListBox1 = new ListBox();
mListBox1.Parent = mFlow;
mListBox1.Size = mFlow.ClientSize;
mListBox1.Location = new Point(0, 0);
mListBox1.Anchor = AnchorStyles.Right | AnchorStyles.Left ;