Microsoft Communities

Welcome to WindowsClient.net | Sign in | Join

Here are some frequently asked questions about Windows Forms and their answers.

Windows Forms FAQs

How can I get the items in a flow layout panel to flow TopDown and stretch from edge to edge?

The sample essentially sizes an item to hold the width to a certain size.

    private void fLP1_Layout(object sender, LayoutEventArgs e) {
   fLP1.Controls[0].Dock = DockStyle.None;
   for (int i = 1; i < fLP1.Controls.Count; i++) {
    fLP1.Controls[i].Dock = DockStyle.Top;
   }
   fLP1.Controls[0].Width = 
fLP1.DisplayRectangle.Width fLP1.Controls[0].Margin.Horizontal;
  }

  // Where the flow layout is set up as
   this.fLP1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
   this.fLP1.Size = new System.Drawing.Size(175, 180);
   this.fLP1.Layout += new System.Windows.Forms.LayoutEventHandler(this.fLP1_Layout);


Page view counter