public void ApplyToGroup(ElemGroup control)
        {
            //ApplyToControl(control);

            control.BorderAll = 0;

            if (this.BorderTop)
            {
                control.BorderTop = 1;
            }
            if (this.BorderBottom)
            {
                control.BorderBottom = 1;
            }
            if (this.BorderLeft)
            {
                control.BorderLeft = 1;
            }
            if (this.BorderRight)
            {
                control.BorderRight = 1;
            }

            control.Invalidate();
        }
Пример #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);
            }
        }