Beispiel #1
0
        internal static WizardPage CreatePage(Wizard parent, bool innerPage, IDesignerHost dh, IComponentChangeService cc, ISelectionService ss, eWizardStyle wizardStyle)
        {
            DesignerTransaction dt = dh.CreateTransaction();
            WizardPage page=null;
            try
            {
                page = dh.CreateComponent(typeof(WizardPage)) as WizardPage;
				
				page.AntiAlias=false;
                page.InteriorPage = innerPage;
                if (innerPage)
                {
                    page.PageTitle = "< Wizard step title >";
                    page.PageDescription = "< Wizard step description >";
                }
                if (wizardStyle == eWizardStyle.Default)
                    ApplyDefaultInnerPageStyle(page, dh, cc);
                else if (wizardStyle == eWizardStyle.Office2007)
                    ApplyOffice2007InnerPageStyle(page, dh, cc);
                //else
                //{
                //    TypeDescriptor.GetProperties(page.Style)["BackColor"].SetValue(page.Style, Color.White);
                //}

                if (cc != null)
                    cc.OnComponentChanging(parent, TypeDescriptor.GetProperties(parent)["WizardPages"]);
                parent.WizardPages.Add(page);
                if (cc != null)
                    cc.OnComponentChanged(parent, TypeDescriptor.GetProperties(parent)["WizardPages"], null, null);

                if (ss != null)
                    ss.SetSelectedComponents(new WizardPage[] { page }, SelectionTypes.Replace);

                TypeDescriptor.GetProperties(parent)["SelectedPageIndex"].SetValue(parent, parent.WizardPages.IndexOf(page));
            }
            catch
            {
                dt.Cancel();
            }
            finally
            {
                if (!dt.Canceled)
                    dt.Commit();
            }

            return page;
        }
Beispiel #2
0
        private void ChangeWizardStyle(eWizardStyle style)
        {
            IComponentChangeService cc = GetService(typeof(IComponentChangeService)) as IComponentChangeService;
            IDesignerHost dh = GetService(typeof(IDesignerHost)) as IDesignerHost;

            DesignerTransaction dt = dh.CreateTransaction();
            try
            {
                Wizard w = this.Control as Wizard;

                w.FooterStyle.Reset();
                if (style == eWizardStyle.Office2007)
                {
                    w.FooterStyle.BackColor = Color.Transparent;
                    w.BackColor = Color.FromArgb(205, 229, 253);
                    w.ForeColor = ColorScheme.GetColor(0x0F3981);
                    w.BackgroundImage = LoadWizardImage(eWizardImages.BackgroundOffice2007);
                    w.HeaderStyle.Reset();
                    w.HeaderStyle.BackColor = Color.Transparent;// ColorScheme.GetColor(0xBFD7F3);
                    w.HeaderStyle.BackColor2 = Color.Empty; // ColorScheme.GetColor(0xDBF1FE);
                    w.HeaderStyle.BackColorGradientAngle = 90;
                    w.HeaderStyle.BorderBottomColor = ColorScheme.GetColor(0x799DB6);
                    w.HeaderStyle.BorderBottomWidth = 1;
                    w.HeaderStyle.BorderBottom = eStyleBorderType.Solid;
                    w.HeaderHeight = 90;
                    w.HeaderDescriptionVisible = false;
                    w.HeaderImageAlignment = eWizardTitleImageAlignment.Left;
                    w.HeaderCaptionFont = new Font(w.Font.FontFamily, 12, FontStyle.Bold);
                }
                else if (style == eWizardStyle.Default)
                {
                    SetDefaultFooterStyle(w);
                    w.BackgroundImage = null;
                    w.BackColor = SystemColors.Control;
                    w.ForeColor = SystemColors.ControlText;
                    w.HeaderStyle.Reset();
                    w.HeaderStyle.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
                    w.HeaderStyle.BackColorGradientAngle = 90;
                    w.HeaderStyle.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Etched;
                    w.HeaderStyle.BorderBottomWidth = 1;
                    w.HeaderStyle.BorderColor = System.Drawing.SystemColors.Control;
                    w.HeaderStyle.BorderLeftWidth = 1;
                    w.HeaderStyle.BorderRightWidth = 1;
                    w.HeaderStyle.BorderTopWidth = 1;
                    w.HeaderStyle.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center;
                    w.HeaderStyle.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText;
                    w.HeaderHeight = 60;
                    w.HeaderDescriptionVisible = true;
                    w.HeaderCaptionFont = new Font(w.Font, FontStyle.Bold);
                    w.HeaderImageAlignment = eWizardTitleImageAlignment.Right;
                }

                for (int i = 0; i < w.WizardPages.Count; i++)
                {
                    WizardPage p = w.WizardPages[i];
                    if (!p.InteriorPage && i==0)
                    {
                        if (style == eWizardStyle.Default)
                            ApplyDefaultWelcomePageStyle(p, null, cc);
                        else if (style == eWizardStyle.Office2007)
                            ApplyOffice2007WelcomePageStyle(p, null, cc);
                    }
                    else
                    {
                        if (style == eWizardStyle.Default)
                            ApplyDefaultInnerPageStyle(p, null, cc);
                        else if (style == eWizardStyle.Office2007)
                            ApplyOffice2007InnerPageStyle(p, null, cc);
                    }
                }
            }
            catch
            {
                dt.Cancel();
            }
            finally
            {
                if(!dt.Canceled)
                    dt.Commit();
            }
        }
Beispiel #3
0
        internal static WizardPage CreateWelcomePage(Wizard parent, IDesignerHost dh, IComponentChangeService cc, ISelectionService ss, eWizardStyle style)
        {
            DesignerTransaction dt = dh.CreateTransaction();
            WizardPage page = null;
            try
            {
                page = dh.CreateComponent(typeof(WizardPage)) as WizardPage;

                if(style == eWizardStyle.Default)
                    ApplyDefaultWelcomePageStyle(page, null, null);
                else
                    ApplyOffice2007WelcomePageStyle(page, null, null);
                //TypeDescriptor.GetProperties(page)["InteriorPage"].SetValue(page, false);
                //TypeDescriptor.GetProperties(page)["BackColor"].SetValue(page, Color.White);
                //TypeDescriptor.GetProperties(page)["CanvasColor"].SetValue(page, Color.White);
                //TypeDescriptor.GetProperties(page.Style)["BackColor"].SetValue(page.Style, Color.White);
                //TypeDescriptor.GetProperties(page.Style)["BackgroundImage"].SetValue(page.Style, GetWelcomeImage(false));
                //TypeDescriptor.GetProperties(page.Style)["BackgroundImagePosition"].SetValue(page.Style, eStyleBackgroundImage.TopLeft);
                page.Size = new Size(534, 289);

                // Load labels onto the page, first Welcome to the Wizard...
                System.Windows.Forms.Label label = dh.CreateComponent(typeof(System.Windows.Forms.Label)) as System.Windows.Forms.Label;
                page.Controls.Add(label);
                label.Location = new Point(210, 18);
                label.Text = "Welcome to the <Wizard Name> Wizard";
                label.BackColor = Color.Transparent;
                try
                {
                    label.Font = new Font("Tahoma", 16);
                    TypeDescriptor.GetProperties(label)["AutoSize"].SetValue(label, false);
                }
                catch { }
                label.Size = new Size(310, 66);
                label.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;

                // Wizard description label...
                label = dh.CreateComponent(typeof(System.Windows.Forms.Label)) as System.Windows.Forms.Label;
                page.Controls.Add(label);
                label.Location = new Point(210, 100);
                label.Text = "This wizard will guide you through the <Enter Process Name>.\r\n\r\n<Enter brief description of the process wizard is covering.>";
                label.BackColor = Color.Transparent;
                try
                {
                    TypeDescriptor.GetProperties(label)["AutoSize"].SetValue(label, false);
                }
                catch { }
                label.Size = new Size(309, 157);
                label.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom;

                // Click Next to Continue label...
                label = dh.CreateComponent(typeof(System.Windows.Forms.Label)) as System.Windows.Forms.Label;
                page.Controls.Add(label);
                label.Location = new Point(210, 266);
                label.Text = "To continue, click Next.";
                label.Size = new Size(120, 13);
                label.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
                label.BackColor = Color.Transparent;
                
                if (cc != null)
                    cc.OnComponentChanging(parent, TypeDescriptor.GetProperties(parent)["WizardPages"]);
                parent.WizardPages.Add(page);
                if (cc != null)
                    cc.OnComponentChanged(parent, TypeDescriptor.GetProperties(parent)["WizardPages"], null, null);


                if (ss != null)
                    ss.SetSelectedComponents(new WizardPage[] { page }, SelectionTypes.Replace);

                TypeDescriptor.GetProperties(parent)["SelectedPageIndex"].SetValue(parent, parent.WizardPages.IndexOf(page));
            }
            catch
            {
                dt.Cancel();
            }
            finally
            {
                if (!dt.Canceled)
                    dt.Commit();
            }

            return page;
        }