Example #1
0
        public void InitOption()
        {
            var PointX        = 20;
            var PointY        = 20;
            var interval      = 5;
            var currentColumn = 0;

            for (int i = 1; i < 50; i++)
            {
                Label lbNum = new Label();
                lbNum.Text      = i.ToString().PadLeft(2, '0');
                lbNum.Size      = new Size(35, 20);
                lbNum.Tag       = lbNum.Text;
                lbNum.BackColor = ServiceNum.GetNumColor(i);
                lbNum.Name      = "Code";
                lbNum.Font      = new System.Drawing.Font("宋体", 15F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))));

                Label lbPL = new Label();
                lbPL.Text = "00.00";
                lbPL.Size = new Size(60, 20);
                lbPL.Tag  = lbNum.Text;
                lbPL.Name = "PL";
                //  lbPL.BackColor = Color.Yellow;
                lbPL.Font = new System.Drawing.Font("宋体", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));

                TextBox txt = new TextBox();
                txt.Tag       = lbNum.Text;
                txt.KeyPress += new System.Windows.Forms.KeyPressEventHandler(Common.TextBox_FilterString_KeyPress);
                txt.Size      = new Size(45, 30);


                if (i == 1 || i == 11 || i == 21 || i == 31 || i == 41)
                {
                    PointY = 20;
                }
                PointX = 20;
                if (i % 10 > 0)
                {
                    currentColumn = i / 10 + 1;
                }
                else
                {
                    currentColumn = i / 10;
                }
                PointX = PointX + 155 * (currentColumn - 1);


                lbNum.Location = new Point(PointX, PointY);
                lbPL.Location  = new Point(PointX + 35, PointY);
                txt.Location   = new Point(PointX + 30 + 65, PointY);

                PointY = PointY + interval + lbNum.Height;

                this.groupBox2.Controls.Add(lbNum);

                this.groupBox2.Controls.Add(lbPL);

                this.groupBox2.Controls.Add(txt);
            }
        }
Example #2
0
File: ULM.cs Project: tanzw/six
        public void InitOption()
        {
            var PointX        = 20;
            var PointY        = 20;
            var interval      = 5;
            var currentColumn = 0;

            for (int i = 1; i < 50; i++)
            {
                Label lbNum = new Label();
                lbNum.Text      = i.ToString().PadLeft(2, '0');
                lbNum.Size      = new Size(35, 20);
                lbNum.Tag       = lbNum.Text;
                lbNum.BackColor = ServiceNum.GetNumColor(i);
                lbNum.Name      = "Code";
                lbNum.Font      = new System.Drawing.Font("宋体", 15F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))));

                CheckBox ck = new CheckBox();
                ck.AutoSize = true;
                ck.TabIndex = i;
                ck.Name     = "CK";
                ck.Tag      = lbNum.Tag;
                ck.Enter   += new System.EventHandler(Common.CheckBox_UpdateColor_Enter);
                ck.Leave   += new System.EventHandler(Common.CheckBox_UpdateColor_Leave);



                if (i == 1 || i == 11 || i == 21 || i == 31 || i == 41)
                {
                    PointY = 20;
                }
                PointX = 20;
                if (i % 10 > 0)
                {
                    currentColumn = i / 10 + 1;
                }
                else
                {
                    currentColumn = i / 10;
                }
                PointX = PointX + 200 * (currentColumn - 1);


                lbNum.Location = new Point(PointX, PointY);

                ck.Location = new Point(PointX + 45, PointY + 4);
                PointY      = PointY + interval + lbNum.Height;

                this.Controls.Add(lbNum);


                this.Controls.Add(ck);
            }
        }