我尝试将x个按钮添加到FlowLayoutPanel,该面板停靠在面板中(DocType填充)。我已将FlowDirection设置为Topdown,因为我希望类似于以下内容:
但是,FlowLayoutPanel具有水平滚动条,而不是垂直滚动条:
我添加如下按钮:
flowLayoutPanel1.Controls.Add(new Button { Text = "Chat", Width = flowLayoutPanel1.Width - flowLayoutPanel1.Margin.Left - flowLayoutPanel1.Margin.Right});
我也试探着:
flowLayoutPanel1.Controls.Add(new Button { Text = "Chat", Dock = DockStyle.Fill});
还有:
flowLayoutPanel1.Controls.Add(new Button { Text = "Chat", Anchor = AnchorStyles.Left | AnchorStyles.Right});
1条答案
按热度按时间pod7payv1#
在对here进行一些挖掘之后,我发现了它。我不得不将FlowLayoutPanel.WrapContents属性设置为false。