Ejemplo n.º 1
0
        Group CreateStep(int insertpos, ActionBase step = null)
        {
            SuspendLayout();
            panelVScroll.SuspendLayout();

            Group g = new Group();

            g.checkit = step;

            g.panel = new Panel();
            g.panel.SuspendLayout();

            g.panel.MouseUp         += panelVScroll_MouseUp;
            g.panel.MouseDown       += panelVScroll_MouseDown;
            g.panel.MouseMove       += panelVScroll_MouseMove;
            g.panel.ContextMenuStrip = contextMenuStrip1;

            g.left          = new ExtendedControls.ButtonExt();
            g.left.Location = new Point(0, panelheightmargin);      // 8 spacing, allow 8*4 to indent
            g.left.Size     = new Size(controlsize, controlsize);
            g.left.Text     = "<";
            g.left.Click   += Left_Clicked;
            g.panel.Controls.Add(g.left);

            g.right          = new ExtendedControls.ButtonExt();
            g.right.Location = new Point(g.left.Right + 2, panelheightmargin);      // 8 spacing, allow 8*4 to indent
            g.right.Size     = new Size(controlsize, controlsize);
            g.right.Text     = ">";
            g.right.Click   += Right_Clicked;
            g.panel.Controls.Add(g.right);

            g.stepname = new ExtendedControls.ComboBoxCustom();
            g.stepname.Items.AddRange(ActionBase.GetActionNameList());
            g.stepname.DropDownHeight = 400;
            if (step != null)
            {
                g.stepname.Text = step.Name;
            }
            g.stepname.SelectedIndexChanged += Stepname_SelectedIndexChanged;
            g.panel.Controls.Add(g.stepname);

            g.value = new ExtendedControls.TextBoxBorder();
            SetValue(g.value, step);
            g.value.TextChanged += Value_TextChanged;
            g.value.Click       += Value_Click;
            g.panel.Controls.Add(g.value);         // must be next

            g.config        = new ExtendedControls.ButtonExt();
            g.config.Text   = "C";
            g.config.Size   = new Size(controlsize, controlsize);
            g.config.Click += ActionConfig_Clicked;
            g.panel.Controls.Add(g.config);         // must be next

            g.up        = new ExtendedControls.ButtonExt();
            g.up.Size   = new Size(controlsize, controlsize);
            g.up.Text   = "^";
            g.up.Click += Up_Clicked;
            g.panel.Controls.Add(g.up);

            g.prog        = new ExtendedControls.ButtonExt();
            g.prog.Size   = new Size(controlsize, controlsize);
            g.prog.Text   = ">";
            g.prog.Click += Prog_Clicked;
            g.panel.Controls.Add(g.prog);

            g.config.Tag = g.stepname.Tag = g.up.Tag = g.value.Tag = g.left.Tag = g.right.Tag = g.prog.Tag = g;

            BaseUtils.ThemeAbleFormsInstance.Instance.ApplyToControls(g.panel, SystemFonts.DefaultFont);

            panelVScroll.Controls.Add(g.panel);

            if (insertpos == -1)
            {
                groups.Add(g);
            }
            else
            {
                groups.Insert(insertpos, g);
            }

            g.panel.ResumeLayout();

            panelVScroll.ResumeLayout();
            ResumeLayout();
            return(g);
        }
        Group CreateStep(int insertpos, ActionBase step = null)
        {
            SuspendLayout();
            panelVScroll.SuspendLayout();

            Group g = new Group();

            // layout sizes as if its in 12 point, then its scaled.

            g.checkit = step;

            g.panel = new Panel();
            g.panel.SuspendLayout();

            g.panel.MouseUp         += panelVScroll_MouseUp;
            g.panel.MouseDown       += panelVScroll_MouseDown;
            g.panel.MouseMove       += panelVScroll_MouseMove;
            g.panel.ContextMenuStrip = contextMenuStrip1;

            int controlsize = 22; // for a 12 point layout..

            g.left          = new ExtendedControls.ExtButton();
            g.left.Location = new Point(0, panelheightmargin);
            g.left.Size     = new Size(controlsize, controlsize);
            g.left.Text     = "<";
            g.left.Click   += Left_Clicked;
            g.panel.Controls.Add(g.left);

            g.right          = new ExtendedControls.ExtButton();
            g.right.Location = new Point(g.left.Right + 2, panelheightmargin);
            g.right.Size     = new Size(controlsize, controlsize);
            g.right.Text     = ">";
            g.right.Click   += Right_Clicked;
            g.panel.Controls.Add(g.right);

            g.stepname      = new ExtendedControls.ExtComboBox();
            g.stepname.Size = new Size(10, controlsize);        // width set by positioning
            g.stepname.Items.AddRange(ActionBase.GetActionNameList());
            if (step != null)
            {
                g.stepname.Text = step.Name;
            }
            g.stepname.SelectedIndexChanged += Stepname_SelectedIndexChanged;
            g.panel.Controls.Add(g.stepname);

            g.value          = new ExtendedControls.ExtTextBox();
            g.value.Location = new Point(200, panelheightmargin); // fixed ref point in 12 point space
            g.value.Size     = new Size(10, controlsize);         // width set by positioning
            SetValue(g.value, step);
            g.value.TextChanged += Value_TextChanged;
            g.value.Click       += Value_Click;
            g.panel.Controls.Add(g.value);         // must be next

            g.config        = new ExtendedControls.ExtButton();
            g.config.Text   = "C";
            g.config.Size   = new Size(controlsize, controlsize);
            g.config.Click += ActionConfig_Clicked;
            g.panel.Controls.Add(g.config);         // must be next

            g.up        = new ExtendedControls.ExtButton();
            g.up.Size   = new Size(controlsize, controlsize);
            g.up.Text   = "^";
            g.up.Click += Up_Clicked;
            g.panel.Controls.Add(g.up);

            g.prog        = new ExtendedControls.ExtButton();
            g.prog.Size   = new Size(controlsize, controlsize);
            g.prog.Text   = ">";
            g.prog.Click += Prog_Clicked;
            g.panel.Controls.Add(g.prog);

            g.config.Tag = g.stepname.Tag = g.up.Tag = g.value.Tag = g.left.Tag = g.right.Tag = g.prog.Tag = g;

            ExtendedControls.Theme.Current.ApplyDialog(g.panel);
            g.panel.Scale(this.CurrentAutoScaleFactor());

            panelVScroll.Controls.Add(g.panel);

            if (insertpos == -1)
            {
                groups.Add(g);
            }
            else
            {
                groups.Insert(insertpos, g);
            }

            g.panel.ResumeLayout();

            panelVScroll.ResumeLayout();
            ResumeLayout();
            return(g);
        }