我正在尝试向FlowLayoutPanel添加x个按钮,该按钮被停靠在一个面板中(DocType填充)。我已经将FlowDirection设置为自顶向下,因为我想要这样的东西:

但是,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});谢谢你的帮助。
发布于 2022-10-19 19:15:46
在挖掘了这里之后,我发现了它。我不得不将FlowLayoutPanel.WrapContents性质设置为false。
https://stackoverflow.com/questions/74117939
复制相似问题