Reply to comment

The stack idea is exactly

The stack idea is exactly what I was thinking for the back button. However for next I decided to create a different InternalWizardPage. I created one that inherits from it (just to keep it simple) set up the buttons with in it (cause that annoyed me to have to do every time I made a new page).

The true key was creating 2 Lists

        List _rbList = new List(); //Used to link the radio button to the next page
        List _nextPages = new List(); //Actual next page

as well as a method to add radio buttons dynamically

public void AddRadioButton(RadioButton rb, string nextPage)
        {
            AdjustLocation();
            rb.Location = _location;
            rb.TabIndex = _tabIndex++;
            rb.CheckedChanged += new EventHandler(rb_CheckedChanged);
            this.Controls.Add(rb);
            _rbList.Add(rb); //Add to the list for easy reference
            _nextPages.Add(nextPage);
            Refresh();
        }

        void rb_CheckedChanged(object sender, EventArgs e)
        {
            if (((RadioButton)sender).Checked)
                _selectedRB = (RadioButton)sender;
        }

        private void AdjustLocation()
        {
            _location = new Point(_location.X, _location.Y + _locOffset.Y);
            if (_location.Y > _bounds.Y)
                throw new ArgumentException("Added too many RadioButtons and the control will now draw out of bounds");
        }

So then the instantiator of this component just needs to send in a RadioButton with its linked page. I created a MakeRadioButton method to set up the basics then I just set the name and text manually before sending it to the page instatiation.

private RadioButton MakeRadioButton()
        {
            RadioButton rb = new RadioButton();
            rb.AutoSize = true;
            rb.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            rb.Size = new System.Drawing.Size(335, 24);
            rb.TabStop = true;
            rb.UseVisualStyleBackColor = true;
            return rb;
        }

Thanks again for your help :)

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <b> <blockquote> <br> <code> <dd> <dl> <dt> <hr> <h1> <h2> <h3> <i> <img> <li> <ol> <p> <pre> <table> <td> <th> <tr> <tt> <u> <ul>
  • Images can be added to this post.

More information about formatting options