Click here to Skip to main content
12,447,625 members (58,626 online)
Click here to Skip to main content
Articles » Languages » C# » General » Downloads

Stats

391.5K views
12.3K downloads
380 bookmarked
Posted

A Simple Wizard Control for .Net 2.0 with Full Designer Support

, 4 Feb 2008 CPOL
This is a simple yet powerful wizard framework for .Net 2.0. Just drag and drop and your component is ready for use.
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using WizardBase.Properties;

namespace WizardBase
{
    [ToolboxItem(false), Designer(typeof (WizardStepDesigner)), DefaultEvent("Click")]
    public class FinishStep : WizardStep
    {
        private ColorPair pair = new ColorPair();

        public FinishStep()
        {
#pragma warning disable DoNotCallOverridableMethodsInConstructor
            Reset();
#pragma warning restore DoNotCallOverridableMethodsInConstructor
        }

        internal override void Reset()
        {
            BackColor = SystemColors.ControlLightLight;
            BindingImage = Resources.back;
            BackgroundImageLayout = ImageLayout.Tile;
        }

        ///<summary>
        ///Raises the <see cref="E:System.Windows.Forms.Control.Paint"></see> event.
        ///</summary>
        ///
        ///<param name="e">A <see cref="T:System.Windows.Forms.PaintEventArgs"></see> that contains the event data. </param>
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            using (Brush brush = new LinearGradientBrush(ClientRectangle, pair.BackColor1, pair.BackColor2, pair.Gradient))
            {
                e.Graphics.FillRectangle(brush, ClientRectangle);
            }
        }

        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public override Image BackgroundImage
        {
            get
            {
                return base.BackgroundImage;
            }
            set
            {
                base.BackgroundImage = value;
            }
        }

        [Browsable(false)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public override Color BackColor
        {
            get
            {
                return base.BackColor;
            }
            set
            {
                base.BackColor = value;
            }
        }

        [Description("Backgroung of the finish step."), Category("Appearance")]
        public Image BindingImage
        {
            get { return base.BackgroundImage; }
            set
            {
                if (value != base.BackgroundImage)
                {
                    base.BackgroundImage = value;
                    Invalidate();
                    OnBindingImageChanged();
                }
            }
        }
        [Description("Appearence of body."), Category("Appearance")]
        public ColorPair Pair
        {
            get { return pair; }
            set
            {
                if (pair != value)
                {
                    pair = value;
                    Invalidate();
                }
            }
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Browsable(false)]
        public override Color ForeColor
        {
            get { return base.ForeColor; }
            set { base.ForeColor = value; }
        }

        public bool ShouldSerializeBindingImage()
        {
            return BindingImage != Resources.back;
        }

        public void ResetBindingImage()
        {
            BindingImage = Resources.back; ;
        }

        public bool ShouldSerializePair()
        {
            return pair != new ColorPair();
        }

        public void ResetPair()
        {
            pair = new ColorPair();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Manish Ranjan Kumar
Software Developer (Senior)
India India
No Biography provided

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160811.3 | Last Updated 4 Feb 2008
Article Copyright 2007 by Manish Ranjan Kumar
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid