我在winforms中有一个flowlayout控件,我已将其流向设置为TopDown但是它从左到右依次添加控件,autoscroll也设置为true。
flowLayoutPanel1.Controls.Clear();
Label labelInput = new Label();
ListBox listBoxNewInput = new ListBox();
//Initialize label's property
labelInput.Text = " #" + Convert.ToInt32(sequence);
labelInput.AutoSize = true;
//Initialize textBoxes Property
listBoxNewInput.HorizontalScrollbar = false;
listBoxNewInput.Items.Add(efforts);
//Add the newly created text box to the list of input text boxes
inputTextBoxesList.Add(listBoxNewInput);
//Add the labels and text box to the form
flowLayoutPanel1.FlowDirection = FlowDirection.TopDown;
flowLayoutPanel1.Controls.Add(labelInput);
flowLayoutPanel1.FlowDirection = FlowDirection.TopDown;
flowLayoutPanel1.Controls.Add(listBoxNewInput);
答案 0 :(得分:24)
将WrapContents
的{{1}}属性设置为flowLayoutPanel1
,如果它们不合适,则不允许在右侧移动这些控件。为了能够滚动剪辑的内容,您可以将false
属性设置为AutoScroll
以下是代码:
true