为什么在flowlayoutPanel中正常添加流面板,而不在Panel中添加

问题描述

我创建了一个在一个更大的flowlayoutpanel内生成flowlayoutpanel的代码,但是随后我遇到了一个问题,即不可能只设置水平工作滚动条(不使用Vertical)。我想出了一个在面板中重新创建它的解决方案。但是,一旦我将flowlayoutpanel更改为面板,它就开始只生成一个自定义流。

 IEnumerable<Tuple<string,string,string>> CollapedList = vardai
           .Zip(kainos,(e1,e2) => new { e1,e2 })
           .Zip(grupes,(z1,e3) => Tuple.Create(z1.e1,z1.e2,e3));

            foreach (var k in CollapedList)
            {
                if (myn.Text == k.Item3)
                {
                    Button Placiau = new Button();
                    Placiau.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))),((int)(((byte)(175)))),((int)(((byte)(241)))));
                    Placiau.FlatAppearance.BorderSize = 2;
                    Placiau.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
                    Placiau.Font = new System.Drawing.Font("Times New Roman",9F,System.Drawing.FontStyle.Bold,System.Drawing.GraphicsUnit.Point,((byte)(0)));
                    Placiau.ForeColor = System.Drawing.Color.White;
                    Placiau.Location = new System.Drawing.Point(12,82);
                    Placiau.Name = "button4";
                    Placiau.Size = new System.Drawing.Size(94,31);
                    Placiau.TabIndex = 14;
                    Placiau.Text = "Plačiau";
                    Placiau.UseVisualStyleBackColor = true;

                    Button Krepselis = new Button();
                    Krepselis.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))),((int)(((byte)(241)))));
                    Krepselis.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))),((int)(((byte)(241)))));
                    Krepselis.FlatAppearance.BorderSize = 2;
                    Krepselis.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
                    Krepselis.Font = new System.Drawing.Font("Times New Roman",((byte)(0)));
                    Krepselis.ForeColor = System.Drawing.Color.White;
                    Krepselis.Location = new System.Drawing.Point(115,82);
                    Krepselis.Size = new System.Drawing.Size(116,31);
                    Krepselis.Text = "Į krepšelį";
                    Krepselis.UseVisualStyleBackColor = false;

                    PictureBox Nuotrauka = new PictureBox();
                    Nuotrauka.Location = new System.Drawing.Point(12,15);
                    Nuotrauka.Size = new System.Drawing.Size(94,57);
                    Nuotrauka.TabStop = false;


                    Label Pavadinimas = new Label();
                    Pavadinimas.AutoSize = true;
                    Pavadinimas.Font = new System.Drawing.Font("Arial Rounded MT Bold",System.Drawing.FontStyle.Regular,((byte)(0)));
                    Pavadinimas.ForeColor = System.Drawing.Color.White;
                    Pavadinimas.Location = new System.Drawing.Point(112,20);
                    Pavadinimas.Size = new System.Drawing.Size(100,17);
                    Pavadinimas.TabIndex = 13;

                    Pavadinimas.Text = k.Item1;

                    Label Kaina = new Label();
                    Kaina.AutoSize = true;
                    Kaina.Font = new System.Drawing.Font("Arial Rounded MT Bold",((byte)(0)));
                    Kaina.ForeColor = System.Drawing.Color.White;
                    Kaina.Location = new System.Drawing.Point(116,55);
                    Kaina.Size = new System.Drawing.Size(50,17);

                    Kaina.Text = k.Item2;

                    Panel my = new Panel();
                    my.Controls.Add(Placiau);
                    my.Controls.Add(Krepselis);
                    my.Controls.Add(Nuotrauka);
                    my.Controls.Add(Kaina);
                    my.Controls.Add(Pavadinimas);
                    my.Size = new System.Drawing.Size(308,137);

                    FlowLayoutPanel myFlow = new FlowLayoutPanel();
                    myFlow.Controls.Add(my);
                    myFlow.Size = new System.Drawing.Size(308,137);

                     Panel6.Controls.Add(myFlow);

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...