예제 #1
0
        private void OnAddPageClick(object sender, EventArgs e)
        {
            WizardForm     ctrl = ( WizardForm )Control;
            WizardPageBase page = new WizardPageBase();

            ctrl.Pages.Add(page);

            IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost));

            if (host != null)
            {
                host.Container.Add(page);
            }
        }
예제 #2
0
        /// <summary>
        /// Custom Drawing of Wizard Page in IDE Designer
        /// </summary>
        /// <param name="pe"></param>
        protected override void OnPaintAdornments(System.Windows.Forms.PaintEventArgs pe)
        {
            base.OnPaintAdornments(pe);

            Graphics g = pe.Graphics;

            WizardPageBase page = Control as WizardPageBase;

            if (page == null)
            {
                page = Component as WizardPageBase;
            }

            if (page != null)
            {
                WizardForm parent = page.WizardPageParent;

                string strPos;

                if (page != null && parent != null)
                {
                    strPos = (parent.Pages.IndexOf(page) + 1).ToString();
                }
                else // if something wrong then simply show MINUS
                {
                    strPos = "-";
                    if (page == null)
                    {
                        strPos += "p";
                    }
                    if (parent == null)
                    {
                        strPos += "P";
                    }
                }

                g.FillRectangle(m_brushBack, m_rect);

                StringFormat frmString = new StringFormat();
                frmString.Alignment     = StringAlignment.Center;
                frmString.LineAlignment = StringAlignment.Center;

                g.DrawString(strPos, m_font, m_brushText, m_rect, frmString);
            }
        }
예제 #3
0
        /// <summary>
        /// Custom Drawing of Wizard Page in IDE Designer
        /// </summary>
        /// <param name="pe"></param>
        protected override void OnPaintAdornments(System.Windows.Forms.PaintEventArgs pe)
        {
            base.OnPaintAdornments(pe);

            Graphics  g = pe.Graphics;
            Rectangle rect;// = pe.ClipRectangle;

            WizardPageBase page = Control as WizardPageBase;

            if (page == null)
            {
                page = Component as WizardPageBase;
            }

            WizardForm parent = (page != null) ? page.WizardPageParent : null;

            string strPos;

            if (page != null && parent != null)
            {
                strPos = (parent.Pages.IndexOf(page) + 1).ToString();
            }
            else // if something wrong then simply show MINUS
            {
                strPos = "-";
                if (page == null)
                {
                    strPos += "p";
                }
                if (parent == null)
                {
                    strPos += "P";
                }
            }

            g.FillRectangle(m_brushBack, m_rect);

            StringFormat frmString = new StringFormat();

            frmString.Alignment     = StringAlignment.Center;
            frmString.LineAlignment = StringAlignment.Center;

            g.DrawString(strPos, m_font, m_brushText, m_rect, frmString);

            if (parent != null)
            {
                rect = parent.GetCurrentPageRect();
                if (rect.Width % 8 > 0)
                {
                    rect.Width = (int)(rect.Width / 8) * 8;
                }

                if (rect.Height % 8 > 0)
                {
                    rect.Height = (int)(rect.Height / 8) * 8;
                }

                if (page != null && page.WelcomePage == false && m_bShowLines == true)
                {
                    Point[] pnt = new Point[]
                    {
                        new Point(new Size(rect.X + 24, rect.Y + 8)),
                        new Point(new Size(rect.X + 24, rect.Bottom - 8)),
                        new Point(new Size(rect.X + 40, rect.Bottom - 8)),
                        new Point(new Size(rect.X + 40, rect.Y + 8)),
                        new Point(new Size(rect.X + 56, rect.Y + 8)),
                        new Point(new Size(rect.X + 56, rect.Bottom - 8)),

                        new Point(new Size(rect.Right - 56, rect.Bottom - 8)),
                        new Point(new Size(rect.Right - 56, rect.Y + 8)),
                        new Point(new Size(rect.Right - 40, rect.Y + 8)),
                        new Point(new Size(rect.Right - 40, rect.Bottom - 8)),
                        new Point(new Size(rect.Right - 24, rect.Bottom - 8)),
                        new Point(new Size(rect.Right - 24, rect.Y + 8)),

                        new Point(new Size(rect.X + 24, rect.Y + 8)),
                        new Point(new Size(rect.X + 24, rect.Bottom - 8)),
                        new Point(new Size(rect.Right - 24, rect.Bottom - 8))
                    };

                    Pen pen = new Pen(Brushes.Black);
                    pen.DashStyle = DashStyle.DashDotDot;
                    g.DrawLines(pen, pnt);
                    pen.Dispose();
                }
            }
        }