예제 #1
0
        /// <summary>
        /// Activates the specified wizard bage.
        /// </summary>
        /// <param name="page">A WizardPage object representing the page to be activated.</param>
        private void ActivatePage(WizardPage page)
        {
            // validate given page
            if (this.pages.Contains(page) == false)
            {
                // filter out
                return;
            }

            // deactivate current page
            if (this.selectedPage != null)
            {
                this.selectedPage.Visible = false;
            }

            // activate new page
            this.selectedPage = page;

            if (this.selectedPage != null)
            {
                //Ensure that this panel displays inside the wizard
                this.selectedPage.Parent = this;
                if (this.Contains(this.selectedPage) == false)
                {
                    this.Container.Add(this.selectedPage);
                }
                if (this.selectedPage.WizardStyle == WizardPage.WizardPageStyle.Finish)
                {
                    this.buttonCancel.Text         = "OK";
                    this.buttonCancel.DialogResult = DialogResult.OK;
                }
                else
                {
                    this.buttonCancel.Text         = "Cancel";
                    this.buttonCancel.DialogResult = DialogResult.Cancel;
                }

                //Make it fill the space
                this.selectedPage.SetBounds(0, 0, this.Width, this.Height - FOOTER_AREA_HEIGHT);
                this.selectedPage.Visible = true;
                this.selectedPage.BringToFront();
                Wizard.FocusFirstTabIndex(this.selectedPage);
            }

            //What should the back button say
            if (this.SelectedIndex > 0)
            {
                buttonBack.Enabled = true;
            }
            else
            {
                buttonBack.Enabled = false;
            }

            //What should the Next button say
            if (this.SelectedIndex < this.pages.Count - 1)
            {
                this.buttonNext.Enabled = true;
            }
            else
            {
                if (this.DesignMode == false)
                {
                    // at runtime disable back button (we finished; there's no point going back)
                    buttonBack.Enabled = false;
                }
                this.buttonNext.Enabled = false;
            }

            // refresh
            if (this.selectedPage != null)
            {
                this.selectedPage.Invalidate();
            }
            else
            {
                this.Invalidate();
            }
        }
 public WizardPagesCollection(Wizard owner)
 {
     this.owner = owner;
 }