首页 > 解决方案 > FlowLayoutPanel 行高问题

问题描述

我想在 FlowLayoutPanel 中添加动态按钮。大纲是:

      {
        flowLayoutPanel1.Controls.Clear();
        flowLayoutPanel1.FlowDirection = FlowDirection.LeftToRight;
        flowLayoutPanel1.AutoScroll = true;
        flowLayoutPanel1.SuspendLayout();
        for (int i = 0; i < 15; i++)
        {
            Button btn = new Button();
            btn.Text = string.Format("button_{0}", i);
            btn.Width = 160;
            btn.Height = 50;
            if ((i) == 4)
            {
                btn.Height = 90;
                btn.Width = 326;
            }
            flowLayoutPanel1.Controls.Add(btn);
            if ((i) == 3)
            {
                flowLayoutPanel1.SetFlowBreak(btn, true);
            }
        }
        flowLayoutPanel1.ResumeLayout(true);
    }

问题是第二行太高了。 在此处输入图像描述

主窗口相当大。</p>

标签: c#winformsflowlayoutpanel

解决方案


推荐阅读