本文介绍了多行自动调整滚动FlowLayoutPanel的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有50幅图像。我需要在 FlowLayoutPanel的添加这些图像,第一排30张图像那套行之后,并在第二排20幅图片。所以,我也需要显示在控制滚动条。

I have 50 images. I need to add these images in FlowLayoutPanel, 30 images for 1st row after that wrap row and 20 images in second row. So I also need to show scrollbars on control.

我划分的视频到帧(图像),并在 FlowLayoutPanel的。当我上传的第一个视频下面是设置图像的代码:

I am dividing video into frames(images) and shown in FlowLayoutPanel. When I upload first video below are the code to set 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 second image I want to show images like in first row we have first video images after break I need to show second video upload images.If anybody knows how it can possible.

推荐答案

要得到的结果就像你在截图中看到:

To get the result like you see in screenshot:


  • 把你的 FlowLayoutPanel的面板自动滚屏属性设置为真正

  • 设置自动调整大小你的 FlowLayoutPanel的真正

  • 财产 FlowLayoutPanel的
    来的li>设置 WrapContent 属性真正(默认)
  • 设置自动滚屏你的 FlowLayoutPanel的来的财产(默认)

  • 当添加控件可以使用的打破控制流这些就是你需要的。

  • Put your FlowLayoutPanel in a Panel with AutoScroll property set to true
  • Set AutoSize property of your FlowLayoutPanel to true
  • Set WrapContent property of your FlowLayoutPanel to true (Default)
  • Set AutoScroll property of your FlowLayoutPanel to false (Default)
  • When adding controls you can use SetFlowBreak to break the flow of controls for those one you need.

屏幕截图

代码

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

Here I am breaking the flow, at 5 and 15.

这篇关于多行自动调整滚动FlowLayoutPanel的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 21:18