コード例 #1
0
        public void ApplyToLabel(ElemLabel control)
        {
            ApplyToControl(control);

            control.TextAlignment = this.TextAlignment;
        }
コード例 #2
0
        public void CreateControl(int height, int widthPersentage, string type, string name, string value, string options)
        {
            Control control = null;

            int width = (this.Width * widthPersentage) / 100;

            if (type == "label")
            {
                control = new ElemLabel();
            }
            if (type == "check")
            {
                control = new ElemCheck();
            }
            if (type == "input")
            {
                control = new ElemInput();
            }
            if (type == "group")
            {
                control = new ElemGroup();
            }

            control.Name = name;

            this.panel1.Controls.Add(control);


            if (type == "group" || type == "check")
            {
                control.Width  = width;
                control.Height = height;
            }
            else
            {
                control.Width  = width - 6;
                control.Height = height - 4;
            }

            if (control as IHaveValue != null)
            {
                (control as IHaveValue).Value = value;
            }

            float right = last_x + width;

            if (right > this.Width)
            {
                last_x     = 0;
                row_y     += row_height;
                row_height = 0;
            }

            if (type == "group" || type == "check")
            {
                control.Location = new System.Drawing.Point(last_x, row_y);
            }
            else
            {
                control.Location = new System.Drawing.Point(last_x + 3, row_y + 2);
            }

            last_x    += width;
            row_height = Math.Max(row_height, height);

            var grop = new ElemOptions(options);

            if (type == "label")
            {
                grop.ApplyToLabel(control as ElemLabel);
            }
            else if (type == "group")
            {
                grop.ApplyToGroup(control as ElemGroup);
            }
            else
            {
                grop.ApplyToControl(control);
            }
        }