Multi-Row Autosize Scrollable FlowLayoutPanel

I have 50 images. I need to add these images in FlowLayoutPanel, 30 images for the 1st line after this line and 20 images in the second line. Therefore, I also need to show the scroll bars on the control.

I am splitting a video into frames (images) and shown in FlowLayoutPanel. When I upload the first video below, this is the code to set the image:

for (i = 1; i < len - 1; i++)
{
    ImagePanel mybt = new ImagePanel(storagePath + words[0] + "_" + 
                                     i + ".jpg", words[0] + "_" + i + ".jpg");
    flowLayoutPanel1.Controls.Add(mybt);
}

After that, when I upload the second image, I want to show the images as in the first line, we have the first video images after the break. I need to show the second video. If anyone knows how this is possible.

+2
source share
1

, :

  • FlowLayoutPanel Panel AutoScroll , true
  • AutoSize FlowLayoutPanel - true
  • WrapContent FlowLayoutPanel - true ( )
  • AutoScroll FlowLayoutPanel - false ( )
  • SetFlowBreak, , .

enter image description here

private void button1_Click(object sender, EventArgs e)
{
    for (int i = 0; i < 20; i++)
    {
        var btn = new Button() { Text = i.ToString() };
        if (i == 5 || i==15 )
            this.flowLayoutPanel1.SetFlowBreak(btn, true);
        this.flowLayoutPanel1.Controls.Add(btn);
    }
}

5 15.

+2

Source: https://habr.com/ru/post/1655937/


All Articles