protected internal void ActivatePage(WizardPage page) { //Deactivate the current if (vActivePage != null) { vActivePage.Visible = false; } //Activate the new page vActivePage = page; if (vActivePage != null) { //Ensure that this panel displays inside the wizard vActivePage.Parent = this; if (this.Contains(vActivePage) == false) { this.Container.Add(vActivePage); } //Make it fill the space vActivePage.Dock = DockStyle.Fill; vActivePage.Visible = true; vActivePage.BringToFront(); vActivePage.FocusFirstTabIndex(); } //What should the back button say if (this.PageIndex > 0) { btnBack.Enabled = true; } else { btnBack.Enabled = false; } //What should the Next button say if (vPages.IndexOf(vActivePage) < vPages.Count - 1 && vActivePage.IsFinishPage == false) { btnNext.Text = btnNextLabel; btnNext.Enabled = true; //Don't close the wizard :) btnNext.DialogResult = DialogResult.None; } else { btnNext.Text = btnFinishLabel; //Dont allow a finish in designer if (DesignMode == true && vPages.IndexOf(vActivePage) == vPages.Count - 1) { btnNext.Enabled = false; } else { btnNext.Enabled = true; //If Not in design mode then allow a close btnNext.DialogResult = DialogResult.None; } } //Cause a refresh if (vActivePage != null) { vActivePage.Invalidate(); } else { this.Invalidate(); } }