예제 #1
0
 /// <summary>
 /// Initializes a new instance of the AnimationPanel class with default settings
 /// </summary>
 public AnimationPanel()
     : base()
 {
     this.headerHeight = 0;
     this.border = new Border();
     this.backImage = null;
 }
        /// <summary>
        /// Forces the use of default empty values
        /// </summary>
        public void SetDefaultEmptyValues()
        {
            // set background color values
            this.specialBackColor = Color.Empty;
            this.normalBackColor = Color.Empty;

            // set border values
            this.specialBorder = Border.Empty;
            this.specialBorderColor = Color.Empty;

            this.normalBorder = Border.Empty;
            this.normalBorderColor = Color.Empty;

            // set padding values
            this.specialPadding = Padding.Empty;
            this.normalPadding = Padding.Empty;

            this.specialBackImage = null;
            this.normalBackImage = null;

            this.watermarkAlignment = ContentAlignment.BottomRight;
        }
        /// <summary>
        /// Gets the Border property
        /// </summary>
        private void ExtractBorder()
        {
            // gets the border property
            Border b = new Border();
            b.Left = Int32.Parse(this.tokenizer.NextToken());
            b.Top = Int32.Parse(this.tokenizer.NextToken());
            b.Right = Int32.Parse(this.tokenizer.NextToken());
            b.Bottom = Int32.Parse(this.tokenizer.NextToken());

            // update the property
            if (style == MAINSECTIONSS)
            {
                if (section == BUTTON || section == HEADER)
                {
                    info.Header.SpecialBorder = b;
                }
                else if (section == TASKLIST)
                {
                    info.Expando.SpecialBorder = b;
                }
            }
            else if (style == SECTIONSS)
            {
                if (section == BUTTON || section == HEADER)
                {
                    info.Header.NormalBorder = b;
                }
                else if (section == TASKLIST)
                {
                    info.Expando.NormalBorder = b;
                }
            }
        }
            /// <summary>
            /// Populates the HeaderInfoSurrogate with data that is to be 
            /// serialized from the specified HeaderInfo
            /// </summary>
            /// <param name="headerInfo">The HeaderInfo that contains the data 
            /// to be serialized</param>
            public void Load(HeaderInfo headerInfo)
            {
                if (headerInfo.TitleFont != null)
                {
                    this.FontName = headerInfo.TitleFont.Name;
                    this.FontSize = headerInfo.TitleFont.SizeInPoints;
                    this.FontStyle = headerInfo.TitleFont.Style;
                }

                this.Margin = headerInfo.Margin;

                this.SpecialBackImage = ThemeManager.ConvertImageToByteArray(headerInfo.SpecialBackImage);
                this.NormalBackImage = ThemeManager.ConvertImageToByteArray(headerInfo.NormalBackImage);

                this.SpecialTitle = ThemeManager.ConvertColorToString(headerInfo.SpecialTitleColor);
                this.NormalTitle = ThemeManager.ConvertColorToString(headerInfo.NormalTitleColor);
                this.SpecialTitleHot = ThemeManager.ConvertColorToString(headerInfo.SpecialTitleHotColor);
                this.NormalTitleHot = ThemeManager.ConvertColorToString(headerInfo.NormalTitleHotColor);

                this.SpecialAlignment = headerInfo.SpecialAlignment;
                this.NormalAlignment = headerInfo.NormalAlignment;

                this.SpecialPadding = headerInfo.SpecialPadding;
                this.NormalPadding = headerInfo.NormalPadding;

                this.SpecialBorder = headerInfo.SpecialBorder;
                this.NormalBorder = headerInfo.NormalBorder;
                this.SpecialBorderColor = ThemeManager.ConvertColorToString(headerInfo.SpecialBorderColor);
                this.NormalBorderColor = ThemeManager.ConvertColorToString(headerInfo.NormalBorderColor);

                this.SpecialBackColor = ThemeManager.ConvertColorToString(headerInfo.SpecialBackColor);
                this.NormalBackColor = ThemeManager.ConvertColorToString(headerInfo.NormalBackColor);

                this.SpecialArrowUp = ThemeManager.ConvertImageToByteArray(headerInfo.SpecialArrowUp);
                this.SpecialArrowUpHot = ThemeManager.ConvertImageToByteArray(headerInfo.SpecialArrowUpHot);
                this.SpecialArrowDown = ThemeManager.ConvertImageToByteArray(headerInfo.SpecialArrowDown);
                this.SpecialArrowDownHot = ThemeManager.ConvertImageToByteArray(headerInfo.SpecialArrowDownHot);
                this.NormalArrowUp = ThemeManager.ConvertImageToByteArray(headerInfo.NormalArrowUp);
                this.NormalArrowUpHot = ThemeManager.ConvertImageToByteArray(headerInfo.NormalArrowUpHot);
                this.NormalArrowDown = ThemeManager.ConvertImageToByteArray(headerInfo.NormalArrowDown);
                this.NormalArrowDownHot = ThemeManager.ConvertImageToByteArray(headerInfo.NormalArrowDownHot);

                this.TitleGradient = headerInfo.TitleGradient;
                this.SpecialGradientStartColor = ThemeManager.ConvertColorToString(headerInfo.SpecialGradientStartColor);
                this.SpecialGradientEndColor = ThemeManager.ConvertColorToString(headerInfo.SpecialGradientEndColor);
                this.NormalGradientStartColor = ThemeManager.ConvertColorToString(headerInfo.NormalGradientStartColor);
                this.NormalGradientEndColor = ThemeManager.ConvertColorToString(headerInfo.NormalGradientEndColor);
                this.GradientOffset = headerInfo.GradientOffset;
            }
        /// <summary>
        /// Initializes a new instance of the ExpandoInfo class with default settings
        /// </summary>
        public ExpandoInfo()
        {
            // set background color values
            this.specialBackColor = Color.Transparent;
            this.normalBackColor = Color.Transparent;

            // set border values
            this.specialBorder = new Border(1, 0, 1, 1);
            this.specialBorderColor = Color.Transparent;

            this.normalBorder = new Border(1, 0, 1, 1);
            this.normalBorderColor = Color.Transparent;

            // set padding values
            this.specialPadding = new Padding(12, 10, 12, 10);
            this.normalPadding = new Padding(12, 10, 12, 10);

            this.specialBackImage = null;
            this.normalBackImage = null;

            this.watermarkAlignment = ContentAlignment.BottomRight;

            this.owner = null;
        }
            /// <summary>
            /// Initializes a new instance of the HeaderInfoSurrogate class with default settings
            /// </summary>
            public HeaderInfoSurrogate()
            {
                this.FontName = null;
                this.FontSize = 8.25f;
                this.FontStyle = FontStyle.Regular;
                this.Margin = 15;

                this.SpecialBackImage = new byte[0];
                this.NormalBackImage = new byte[0];

                this.SpecialTitle = ThemeManager.ConvertColorToString(Color.Empty);
                this.NormalTitle = ThemeManager.ConvertColorToString(Color.Empty);
                this.SpecialTitleHot = ThemeManager.ConvertColorToString(Color.Empty);
                this.NormalTitleHot = ThemeManager.ConvertColorToString(Color.Empty);

                this.SpecialAlignment = ContentAlignment.MiddleLeft;
                this.NormalAlignment = ContentAlignment.MiddleLeft;

                this.SpecialPadding = Padding.Empty;
                this.NormalPadding = Padding.Empty;

                this.SpecialBorder = Border.Empty;
                this.NormalBorder = Border.Empty;
                this.SpecialBorderColor = ThemeManager.ConvertColorToString(Color.Empty);
                this.NormalBorderColor = ThemeManager.ConvertColorToString(Color.Empty);

                this.SpecialBackColor = ThemeManager.ConvertColorToString(Color.Empty);
                this.NormalBackColor = ThemeManager.ConvertColorToString(Color.Empty);

                this.SpecialArrowUp = new byte[0];
                this.SpecialArrowUpHot = new byte[0];
                this.SpecialArrowDown = new byte[0];
                this.SpecialArrowDownHot = new byte[0];
                this.NormalArrowUp = new byte[0];
                this.NormalArrowUpHot = new byte[0];
                this.NormalArrowDown = new byte[0];
                this.NormalArrowDownHot = new byte[0];

                this.TitleGradient = false;
                this.SpecialGradientStartColor = ThemeManager.ConvertColorToString(Color.Empty);
                this.SpecialGradientEndColor = ThemeManager.ConvertColorToString(Color.Empty);
                this.NormalGradientStartColor = ThemeManager.ConvertColorToString(Color.Empty);
                this.NormalGradientEndColor = ThemeManager.ConvertColorToString(Color.Empty);
                this.GradientOffset = 0.5f;
            }
            protected HeaderInfoSurrogate(SerializationInfo info, StreamingContext context)
                : base()
            {
                int version = info.GetInt32("Version");

                this.FontName = info.GetString("FontName");
                this.FontSize = info.GetSingle("FontSize");
                this.FontStyle = (FontStyle) info.GetValue("FontStyle", typeof(FontStyle));

                this.Margin = info.GetInt32("Margin");

                this.SpecialBackImage = (byte[]) info.GetValue("SpecialBackImage", typeof(byte[]));
                this.NormalBackImage = (byte[]) info.GetValue("NormalBackImage", typeof(byte[]));

                this.SpecialTitle = info.GetString("SpecialTitle");
                this.NormalTitle = info.GetString("NormalTitle");
                this.SpecialTitleHot = info.GetString("SpecialTitleHot");
                this.NormalTitleHot = info.GetString("NormalTitleHot");

                this.SpecialAlignment = (ContentAlignment) info.GetValue("SpecialAlignment", typeof(ContentAlignment));
                this.NormalAlignment = (ContentAlignment) info.GetValue("NormalAlignment", typeof(ContentAlignment));

                this.SpecialPadding = (Padding) info.GetValue("SpecialPadding", typeof(Padding));
                this.NormalPadding = (Padding) info.GetValue("NormalPadding", typeof(Padding));

                this.SpecialBorder = (Border) info.GetValue("SpecialBorder", typeof(Border));
                this.NormalBorder = (Border) info.GetValue("NormalBorder", typeof(Border));
                this.SpecialBorderColor = info.GetString("SpecialBorderColor");
                this.NormalBorderColor = info.GetString("NormalBorderColor");

                this.SpecialBackColor = info.GetString("SpecialBackColor");
                this.NormalBackColor = info.GetString("NormalBackColor");

                this.SpecialArrowUp = (byte[]) info.GetValue("SpecialArrowUp", typeof(byte[]));
                this.SpecialArrowUpHot = (byte[]) info.GetValue("SpecialArrowUpHot", typeof(byte[]));
                this.SpecialArrowDown = (byte[]) info.GetValue("SpecialArrowDown", typeof(byte[]));
                this.SpecialArrowDownHot = (byte[]) info.GetValue("SpecialArrowDownHot", typeof(byte[]));
                this.NormalArrowUp = (byte[]) info.GetValue("NormalArrowUp", typeof(byte[]));
                this.NormalArrowUpHot = (byte[]) info.GetValue("NormalArrowUpHot", typeof(byte[]));
                this.NormalArrowDown = (byte[]) info.GetValue("NormalArrowDown", typeof(byte[]));
                this.NormalArrowDownHot = (byte[]) info.GetValue("NormalArrowDownHot", typeof(byte[]));

                this.TitleGradient = info.GetBoolean("TitleGradient");
                this.SpecialGradientStartColor = info.GetString("SpecialGradientStartColor");
                this.SpecialGradientEndColor = info.GetString("SpecialGradientEndColor");
                this.NormalGradientStartColor = info.GetString("NormalGradientStartColor");
                this.NormalGradientEndColor = info.GetString("NormalGradientEndColor");
                this.GradientOffset = info.GetSingle("GradientOffset");
            }
        /// <summary>
        /// Forces the use of default empty values
        /// </summary>
        public void SetDefaultEmptyValues()
        {
            // work out the default font name for the user's os
            this.titleFont = null;

            this.margin = 15;

            // set title colors and alignment
            this.specialTitle = Color.Empty;
            this.specialTitleHot = Color.Empty;

            this.normalTitle = Color.Empty;
            this.normalTitleHot = Color.Empty;

            this.specialAlignment = ContentAlignment.MiddleLeft;
            this.normalAlignment = ContentAlignment.MiddleLeft;

            // set padding values
            this.specialPadding = Padding.Empty;
            this.normalPadding = Padding.Empty;

            // set border values
            this.specialBorder = Border.Empty;
            this.specialBorderColor = Color.Empty;
            this.specialBackColor = Color.Empty;

            this.normalBorder = Border.Empty;
            this.normalBorderColor = Color.Empty;
            this.normalBackColor = Color.Empty;

            // set background image values
            this.specialBackImage = null;
            this.normalBackImage = null;

            this.backImageWidth = 186;
            this.backImageHeight = 25;

            // set arrow values
            this.specialArrowUp = null;
            this.specialArrowUpHot = null;
            this.specialArrowDown = null;
            this.specialArrowDownHot = null;

            this.normalArrowUp = null;
            this.normalArrowUpHot = null;
            this.normalArrowDown = null;
            this.normalArrowDownHot = null;

            this.useTitleGradient = false;
            this.specialGradientStartColor = Color.Empty;
            this.specialGradientEndColor = Color.Empty;
            this.normalGradientStartColor = Color.Empty;
            this.normalGradientEndColor = Color.Empty;
            this.gradientOffset = 0.5f;
            this.titleRadius = 2;

            this.rightToLeft = false;
        }
        /// <summary>
        /// Initializes a new instance of the HeaderInfo class with default settings
        /// </summary>
        public HeaderInfo()
        {
            // work out the default font name for the user's os.
            // this ignores other fonts that may be specified - need
            // to change parser to get font names
            if (Environment.OSVersion.Version.Major >= 5)
            {
                // Win2k, XP, Server 2003
                this.titleFont = new Font("Tahoma", 8.25f, FontStyle.Bold);
            }
            else
            {
                // Win9x, ME, NT
                this.titleFont = new Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold);
            }

            this.margin = 15;

            // set title colors and alignment
            this.specialTitle = Color.Transparent;
            this.specialTitleHot = Color.Transparent;

            this.normalTitle = Color.Transparent;
            this.normalTitleHot = Color.Transparent;

            this.specialAlignment = ContentAlignment.MiddleLeft;
            this.normalAlignment = ContentAlignment.MiddleLeft;

            // set padding values
            this.specialPadding = new Padding(10, 0, 1, 0);
            this.normalPadding = new Padding(10, 0, 1, 0);

            // set border values
            this.specialBorder = new Border(2, 2, 2, 0);
            this.specialBorderColor = Color.Transparent;

            this.normalBorder = new Border(2, 2, 2, 0);
            this.normalBorderColor = Color.Transparent;

            this.specialBackColor = Color.Transparent;
            this.normalBackColor = Color.Transparent;

            // set background image values
            this.specialBackImage = null;
            this.normalBackImage = null;

            this.backImageWidth = -1;
            this.backImageHeight = -1;

            // set arrow values
            this.specialArrowUp = null;
            this.specialArrowUpHot = null;
            this.specialArrowDown = null;
            this.specialArrowDownHot = null;

            this.normalArrowUp = null;
            this.normalArrowUpHot = null;
            this.normalArrowDown = null;
            this.normalArrowDownHot = null;

            this.useTitleGradient = false;
            this.specialGradientStartColor = Color.White;
            this.specialGradientEndColor = SystemColors.Highlight;
            this.normalGradientStartColor = Color.White;
            this.normalGradientEndColor = SystemColors.Highlight;
            this.gradientOffset = 0.5f;
            this.titleRadius = 5;

            this.owner = null;
            this.rightToLeft = false;
        }
            /// <summary>
            /// Populates the ExpandoInfoSurrogate with data that is to be 
            /// serialized from the specified ExpandoInfo
            /// </summary>
            /// <param name="expandoInfo">The ExpandoInfo that contains the data 
            /// to be serialized</param>
            public void Load(ExpandoInfo expandoInfo)
            {
                this.SpecialBackColor = ThemeManager.ConvertColorToString(expandoInfo.SpecialBackColor);
                this.NormalBackColor =ThemeManager.ConvertColorToString( expandoInfo.NormalBackColor);

                this.SpecialBorder = expandoInfo.SpecialBorder;
                this.NormalBorder = expandoInfo.NormalBorder;

                this.SpecialBorderColor = ThemeManager.ConvertColorToString(expandoInfo.SpecialBorderColor);
                this.NormalBorderColor = ThemeManager.ConvertColorToString(expandoInfo.NormalBorderColor);

                this.SpecialPadding = expandoInfo.SpecialPadding;
                this.NormalPadding = expandoInfo.NormalPadding;

                this.SpecialBackImage = ThemeManager.ConvertImageToByteArray(expandoInfo.SpecialBackImage);
                this.NormalBackImage = ThemeManager.ConvertImageToByteArray(expandoInfo.NormalBackImage);

                this.WatermarkAlignment = expandoInfo.WatermarkAlignment;
            }
            protected ExpandoInfoSurrogate(SerializationInfo info, StreamingContext context)
                : base()
            {
                int version = info.GetInt32("Version");

                this.SpecialBackColor = info.GetString("SpecialBackColor");
                this.NormalBackColor = info.GetString("NormalBackColor");

                this.SpecialBorder = (Border) info.GetValue("SpecialBorder", typeof(Border));
                this.NormalBorder = (Border) info.GetValue("NormalBorder", typeof(Border));

                this.SpecialBorderColor = info.GetString("SpecialBorderColor");
                this.NormalBorderColor = info.GetString("NormalBorderColor");

                this.SpecialPadding = (Padding) info.GetValue("SpecialPadding", typeof(Padding));
                this.NormalPadding = (Padding) info.GetValue("NormalPadding", typeof(Padding));

                this.SpecialBackImage = (byte[]) info.GetValue("SpecialBackImage", typeof(byte[]));
                this.NormalBackImage = (byte[]) info.GetValue("NormalBackImage", typeof(byte[]));

                this.WatermarkAlignment = (ContentAlignment) info.GetValue("WatermarkAlignment", typeof(ContentAlignment));
            }
            /// <summary>
            /// Initializes a new instance of the ExpandoInfoSurrogate class with default settings
            /// </summary>
            public ExpandoInfoSurrogate()
            {
                this.SpecialBackColor = ThemeManager.ConvertColorToString(Color.Empty);
                this.NormalBackColor = ThemeManager.ConvertColorToString(Color.Empty);

                this.SpecialBorder = Border.Empty;
                this.NormalBorder = Border.Empty;

                this.SpecialBorderColor = ThemeManager.ConvertColorToString(Color.Empty);
                this.NormalBorderColor = ThemeManager.ConvertColorToString(Color.Empty);

                this.SpecialPadding = Padding.Empty;
                this.NormalPadding = Padding.Empty;

                this.SpecialBackImage = new byte[0];
                this.NormalBackImage = new byte[0];

                this.WatermarkAlignment = ContentAlignment.BottomRight;
            }