Example #1
0
        private void AddStep()
        {
            StepControl step  = new StepControl((ushort)steps.Count);
            RowStyle    style = new RowStyle(SizeType.AutoSize);

            if (steps.Count > 0)
            {
                tableSteps.RowCount += 1;
                tableSteps.RowStyles.Add(style);
            }
            else
            {
                tableSteps.RowStyles[0] = style;
            }

            tableSteps.Controls.Add(step, 0, steps.Count);
            steps.Add(step);

            if (steps.Count == ushort.MaxValue)
            {
                btnAddNew.Visible = false;
            }

            btnRemoveLast.Visible = true;
        }
Example #2
0
        private void btnRemoveLast_Click(object sender, EventArgs e)
        {
            StepControl step = steps[steps.Count - 1];

            tableSteps.Controls.Remove(step);
            tableSteps.RowStyles.RemoveAt(tableSteps.RowStyles.Count - 1);
            tableSteps.RowCount -= 1;

            steps.Remove(step);

            if (steps.Count == 1)
            {
                btnRemoveLast.Visible = false;
            }

            btnAddNew.Visible = true;
        }