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);
                }
            }
  • 相关阅读:
    [原创]利用Browser协议探测内网主机操作系统版本(无需端口无视防火墙)
    [EXP]Microsoft Windows 10 (Build 17134)
    [EXP]Microsoft Windows
    [EXP]Apache Spark
    [EXP]Adobe ColdFusion 2018
    [EXP]ThinkPHP 5.0.23/5.1.31
    [EXP]Cisco RV110W
    [EXP]Huawei Router HG532e
    [EXP]Microsoft Windows CONTACT
    [EXP]Microsoft Windows 10
  • 原文地址:https://www.cnblogs.com/qixinjian/p/11881728.html
Copyright © 2011-2022 走看看