Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FlowLayoutPanel AutoSize only in vertical?

I'm loading images dynamically inside a FlowLayoutPanel. I need for this panel to auto-size but only vertically.

Is this possible, and if so, how do I go about achieving it?

like image 847
Ladessa Avatar asked Apr 08 '13 13:04

Ladessa


3 Answers

Maybe

FlowLayoutPanel1.WrapContents = False;
FlowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;

will help you.

like image 116
help Avatar answered Nov 20 '22 19:11

help


Simple, add a event of type control added:

private void flowLayoutPanel1_ControlAdded(object sender, ControlEventArgs e)
{
    if (flowLayoutPanel1.Controls.Count % 10 == 0)
        flowLayoutPanel1.SetFlowBreak(e.Control as Control, true);
}

set AutoSize = true

set flowdirection = LeftToRight

like image 31
Nicolas Tyler Avatar answered Nov 20 '22 19:11

Nicolas Tyler


I did set the Size from panel dinamically. Example:

int newHeight= listImages.Count/10 * 100;
               flowLayoutPanel1.Size = new Size(1143, newHeight);

It works for me. Thx all

like image 1
Ladessa Avatar answered Nov 20 '22 18:11

Ladessa