簡體   English   中英

多行自動調整Scrollable FlowLayoutPanel

[英]Multi-Row Autosize Scrollable FlowLayoutPanel

我有50張圖片。 我需要在FlowLayoutPanel添加這些圖像,在包裹行后第一行添加30個圖像,在第二行添加20個圖像。 所以我還需要在控件上顯示滾動條。

我將視頻划分為幀(圖像)並顯示在FlowLayoutPanel 當我上傳第一個視頻時,下面是設置圖像的代碼:

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

之后,當我上傳第二張圖片時,我想要顯示像第一行中的圖像,我們在休息后有第一個視頻圖像,我需要顯示第二個視頻上傳圖像。 如果有人知道它怎么可能。

要獲得屏幕截圖中顯示的結果:

  • FlowLayoutPanel放在PanelAutoScroll屬性設置為true
  • FlowLayoutPanel AutoSize屬性設置為true
  • FlowLayoutPanel WrapContent屬性設置為true (默認)
  • FlowLayoutPanel AutoScroll屬性設置為false (默認)
  • 添加控件時,您可以使用SetFlowBreak來打破所需控件的控件流。

截圖

在此輸入圖像描述

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。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM