zoukankan      html  css  js  c++  java
  • 动态增删改控件

    private void AddGroup()
            {
                for (int i = 0; i < 5; i++)
                {
                    GroupBox gbox = new GroupBox();
                    gbox.Name = "gbox" + i;
                    gbox.Text = i + "号清洗机";
                    gbox.Size = new Size(1280, 200);
                    gbox.Location = new Point(30, 230 * i + 30);
                    this.Controls.Add(gbox);
                    AddStepLab(gbox);
                }
            }
    
            private void AddStepLab(GroupBox gbox)
            {
                int jiange = (1280 - 100 * 5) / 6;
                for (int i = 0; i < 5; i++)
                {
                    Label lab = new Label();
                    lab.Name = "labStep" + i;
                    lab.Text = i + "次洗";
                    lab.TextAlign = ContentAlignment.MiddleCenter;//文字居中
                    lab.Location = new Point((jiange + 100) * i + jiange, 80);
                    lab.Size = new Size(100, 40);
                    lab.BorderStyle = BorderStyle.FixedSingle;
                    gbox.Controls.Add(lab);
                }
            }
    
            private void AddLabInfo(int gboxNum, int labStepNum)
            {
                Control gbox = this.Controls.Find("gbox" + gboxNum, false)[0];
                Control labS = gbox.Controls.Find("labStep" + labStepNum, false)[0];
                for (int i = 0; i < 2; i++)
                {
                    Label lab = new Label();
                    lab.Name = "NJ100" + i;
                    lab.Text = "EMM100/NJ100";
                    if (i == 0)
                        lab.Location = new Point(labS.Location.X, labS.Location.Y - 20);
                    else
                        lab.Location = new Point(labS.Location.X, labS.Location.Y + labS.Size.Height + 20);
    
                    lab.Size = new Size(100, 30);
                    gbox.Controls.Add(lab);
                }
            }
            private void DelLabInfo(string gboxNum, string EndCode)
            {
                Control gbox = this.Controls.Find("gbox" + gboxNum, false)[0];
                for (int i = 0; i < 2; i++)
                {
                    Control labS = gbox.Controls.Find(EndCode + i, false)[0];
                    gbox.Controls.Remove(labS);
                }
            }
  • 相关阅读:
    基础DP(初级版)
    UVA-816.Abbott's Tevenge (BFS + 打印路径)
    1044: 数圈
    1049: 打牌
    1047: 小A的计算器
    1046: 最小的K个数
    1045: 愚人节的礼物
    1044: 数圈
    1043: 绩点计算
    1042: 小丑排序
  • 原文地址:https://www.cnblogs.com/qixinjian/p/11881728.html
Copyright © 2011-2022 走看看