1

I did some browsing and could not find an answered question that addresses this issue.

My winform consists of a fill-docked flow control with a bunch of other controls in it. More controls leave and are added during runtime, so I have the flowcontrol (and the winform) autosize to fit everything as it appears.

The issue is, I want scrollbars to appear once the form exceeds a certain size. So if the form is small, it continues to autosize to fit, but once it gets about a certain height, the internal flowcontrol keeps doing its thing but the form stops growing and a scroll bar appears.

Is there a way to do this? All combinations of dock, autoscroll, and autosize that I tried were fruitless, but maybe I was doing it wrong.

Just a quick note - currently, once the flowcontrol grows to be taller than the screen, it moves everything below that line over to a new column. I would also like to disable this, so that it continues to grow vertically regardless of screen height (because I will have scroll bars).

4

1 回答 1

1

放入FlowLayoutPanel面板panel1

panel1.AutoScroll = true;
panel1.Dock = DockStyle.Fill; //if you want

FlowLayoutControl.AutoSize = true;
FlowLayoutControl.AutoScroll = false;
FlowLayoutControl.Dock = DockStyle.None;
FlowLayoutControl.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
FlowLayoutControl.Location = new Point(0,0);
FlowLayoutControl.Size = new Size(FlowLayoutControl.Width, 0);
于 2013-03-25T19:18:28.360 回答