Beispiel #1
0
 /// <summary>
 /// Forces the use of default empty values
 /// </summary>
 public void SetDefaultEmptyValues()
 {
     this.padding        = PaddingEx.Empty;
     this.margin         = Margin.Empty;
     this.linkNormal     = Color.Empty;
     this.linkHot        = Color.Empty;
     this.fontDecoration = FontStyle.Underline;
 }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the TaskItemInfoSurrogate class with default settings
        /// </summary>
        public TaskItemInfoSurrogate()
        {
            this.Padding = PaddingEx.Empty;
            this.Margin  = Margin.Empty;

            this.LinkNormal = Tools.Drawing.ConvertColorToString(Color.Empty);
            this.LinkHot    = Tools.Drawing.ConvertColorToString(Color.Empty);

            this.FontDecoration = FontStyle.Regular;
        }
Beispiel #3
0
        /// <summary>
        /// Populates the TaskItemInfoSurrogate with data that is to be
        /// serialized from the specified TaskItemInfo
        /// </summary>
        /// <param name="taskItemInfo">The TaskItemInfo that contains the data
        /// to be serialized</param>
        public void Load(TaskItemInfo taskItemInfo)
        {
            this.Padding = taskItemInfo.Padding;
            this.Margin  = taskItemInfo.Margin;

            this.LinkNormal = Tools.Drawing.ConvertColorToString(taskItemInfo.LinkColor);
            this.LinkHot    = Tools.Drawing.ConvertColorToString(taskItemInfo.HotLinkColor);

            this.FontDecoration = taskItemInfo.FontDecoration;
        }
Beispiel #4
0
        /// <summary>
        /// Converts the given value object to the specified type, using
        /// the specified context and culture information
        /// </summary>
        /// <param name="context">An ITypeDescriptorContext that provides
        /// a format context</param>
        /// <param name="culture">A CultureInfo object. If a null reference
        /// is passed, the current culture is assumed</param>
        /// <param name="value">The Object to convert</param>
        /// <param name="destinationType">The Type to convert the value
        /// parameter to</param>
        /// <returns>An Object that represents the converted value</returns>
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == null)
            {
                throw new ArgumentNullException("destinationType");
            }

            if ((destinationType == typeof(string)) && (value is PaddingEx))
            {
                PaddingEx p = (PaddingEx)value;

                if (culture == null)
                {
                    culture = CultureInfo.CurrentCulture;
                }

                string separator = culture.TextInfo.ListSeparator + " ";

                TypeConverter converter = TypeDescriptor.GetConverter(typeof(int));

                string[] s = new string[4];

                s[0] = converter.ConvertToString(context, culture, p.Left);
                s[1] = converter.ConvertToString(context, culture, p.Top);
                s[2] = converter.ConvertToString(context, culture, p.Right);
                s[3] = converter.ConvertToString(context, culture, p.Bottom);

                return(string.Join(separator, s));
            }

            if ((destinationType == typeof(InstanceDescriptor)) && (value is PaddingEx))
            {
                PaddingEx p = (PaddingEx)value;

                Type[] t = new Type[4];
                t[0] = t[1] = t[2] = t[3] = typeof(int);

                ConstructorInfo info = typeof(PaddingEx).GetConstructor(t);

                if (info != null)
                {
                    object[] o = new object[4];

                    o[0] = p.Left;
                    o[1] = p.Top;
                    o[2] = p.Right;
                    o[3] = p.Bottom;

                    return(new InstanceDescriptor(info, o));
                }
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
Beispiel #5
0
        protected TaskItemInfoSurrogate(SerializationInfo info, StreamingContext context)
            : base()
        {
            int version = info.GetInt32("Version");

            this.Padding = (PaddingEx)info.GetValue("Padding", typeof(PaddingEx));
            this.Margin  = (Margin)info.GetValue("Margin", typeof(Margin));

            this.LinkNormal = info.GetString("LinkNormal");
            this.LinkHot    = info.GetString("LinkHot");

            this.FontDecoration = (FontStyle)info.GetValue("FontDecoration", typeof(FontStyle));
        }
        /// <summary>
        /// Populates the TaskPaneInfoSurrogate with data that is to be
        /// serialized from the specified TaskPaneInfo
        /// </summary>
        /// <param name="taskPaneInfo">The TaskPaneInfo that contains the data
        /// to be serialized</param>
        public void Load(TaskPaneInfo taskPaneInfo)
        {
            this.GradientStartColor = Tools.Drawing.ConvertColorToString(taskPaneInfo.GradientStartColor);
            this.GradientEndColor   = Tools.Drawing.ConvertColorToString(taskPaneInfo.GradientEndColor);
            this.GradientDirection  = taskPaneInfo.GradientDirection;

            this.Padding = taskPaneInfo.Padding;

            this.BackImage   = taskPaneInfo.BackImage.ToByteArray();
            this.StretchMode = taskPaneInfo.StretchMode;

            this.Watermark          = taskPaneInfo.Watermark.ToByteArray();
            this.WatermarkAlignment = taskPaneInfo.WatermarkAlignment;
        }
        /// <summary>
        /// Initializes a new instance of the TaskPaneInfoSurrogate class with default settings
        /// </summary>
        public TaskPaneInfoSurrogate()
        {
            this.GradientStartColor = Tools.Drawing.ConvertColorToString(Color.Empty);
            this.GradientEndColor   = Tools.Drawing.ConvertColorToString(Color.Empty);
            this.GradientDirection  = LinearGradientMode.Vertical;

            this.Padding = PaddingEx.Empty;

            this.BackImage   = new byte[0];
            this.StretchMode = ImageStretchMode.Normal;

            this.Watermark          = new byte[0];
            this.WatermarkAlignment = ContentAlignment.BottomCenter;
        }
        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 = (PaddingEx)info.GetValue("SpecialPadding", typeof(PaddingEx));
            this.NormalPadding  = (PaddingEx)info.GetValue("NormalPadding", typeof(PaddingEx));

            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>
        /// 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 = headerInfo.SpecialBackImage.ToByteArray();
            this.NormalBackImage  = headerInfo.NormalBackImage.ToByteArray();

            this.SpecialTitle    = Tools.Drawing.ConvertColorToString(headerInfo.SpecialTitleColor);
            this.NormalTitle     = Tools.Drawing.ConvertColorToString(headerInfo.NormalTitleColor);
            this.SpecialTitleHot = Tools.Drawing.ConvertColorToString(headerInfo.SpecialTitleHotColor);
            this.NormalTitleHot  = Tools.Drawing.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 = Tools.Drawing.ConvertColorToString(headerInfo.SpecialBorderColor);
            this.NormalBorderColor  = Tools.Drawing.ConvertColorToString(headerInfo.NormalBorderColor);

            this.SpecialBackColor = Tools.Drawing.ConvertColorToString(headerInfo.SpecialBackColor);
            this.NormalBackColor  = Tools.Drawing.ConvertColorToString(headerInfo.NormalBackColor);

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

            this.TitleGradient             = headerInfo.TitleGradient;
            this.SpecialGradientStartColor = Tools.Drawing.ConvertColorToString(headerInfo.SpecialGradientStartColor);
            this.SpecialGradientEndColor   = Tools.Drawing.ConvertColorToString(headerInfo.SpecialGradientEndColor);
            this.NormalGradientStartColor  = Tools.Drawing.ConvertColorToString(headerInfo.NormalGradientStartColor);
            this.NormalGradientEndColor    = Tools.Drawing.ConvertColorToString(headerInfo.NormalGradientEndColor);
            this.GradientOffset            = headerInfo.GradientOffset;
        }
Beispiel #10
0
        /// <summary>
        /// Tests whether obj is a Padding structure with the same values as
        /// this Padding structure
        /// </summary>
        /// <param name="obj">The Object to test</param>
        /// <returns>This method returns true if obj is a Padding structure
        /// and its Left, Top, Right, and Bottom properties are equal to
        /// the corresponding properties of this Padding structure;
        /// otherwise, false</returns>
        public override bool Equals(object obj)
        {
            if (!(obj is PaddingEx))
            {
                return(false);
            }

            PaddingEx padding = (PaddingEx)obj;

            if (((padding.Left == this.Left) && (padding.Top == this.Top)) && (padding.Right == this.Right))
            {
                return(padding.Bottom == this.Bottom);
            }

            return(false);
        }
Beispiel #11
0
        /// <summary>
        /// Initializes a new instance of the TaskLinkInfo class with default settings
        /// </summary>
        public TaskItemInfo()
        {
            // set padding values
            this.padding = new PaddingEx(6, 0, 4, 0);

            // set margin values
            this.margin = new Margin(0, 4, 0, 0);

            // set text values
            this.linkNormal = SystemColors.ControlText;
            this.linkHot    = SystemColors.ControlText;

            this.fontDecoration = FontStyle.Underline;

            this.owner = null;
        }
        protected TaskPaneInfoSurrogate(SerializationInfo info, StreamingContext context)
            : base()
        {
            int version = info.GetInt32("Version");

            this.GradientStartColor = info.GetString("GradientStartColor");
            this.GradientEndColor   = info.GetString("GradientEndColor");
            this.GradientDirection  = (LinearGradientMode)info.GetValue("GradientDirection", typeof(LinearGradientMode));

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

            this.BackImage   = (byte[])info.GetValue("BackImage", typeof(byte[]));
            this.StretchMode = (ImageStretchMode)info.GetValue("StretchMode", typeof(ImageStretchMode));

            this.Watermark          = (byte[])info.GetValue("Watermark", typeof(byte[]));
            this.WatermarkAlignment = (ContentAlignment)info.GetValue("WatermarkAlignment", typeof(ContentAlignment));
        }
        /// <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    = Tools.Drawing.ConvertColorToString(Color.Empty);
            this.NormalTitle     = Tools.Drawing.ConvertColorToString(Color.Empty);
            this.SpecialTitleHot = Tools.Drawing.ConvertColorToString(Color.Empty);
            this.NormalTitleHot  = Tools.Drawing.ConvertColorToString(Color.Empty);

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

            this.SpecialPadding = PaddingEx.Empty;
            this.NormalPadding  = PaddingEx.Empty;

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

            this.SpecialBackColor = Tools.Drawing.ConvertColorToString(Color.Empty);
            this.NormalBackColor  = Tools.Drawing.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 = Tools.Drawing.ConvertColorToString(Color.Empty);
            this.SpecialGradientEndColor   = Tools.Drawing.ConvertColorToString(Color.Empty);
            this.NormalGradientStartColor  = Tools.Drawing.ConvertColorToString(Color.Empty);
            this.NormalGradientEndColor    = Tools.Drawing.ConvertColorToString(Color.Empty);
            this.GradientOffset            = 0.5f;
        }
        /// <summary>
        /// Initializes a new instance of the ExpandoInfoSurrogate class with default settings
        /// </summary>
        public ExpandoInfoSurrogate()
        {
            this.SpecialBackColor = Tools.Drawing.ConvertColorToString(Color.Empty);
            this.NormalBackColor  = Tools.Drawing.ConvertColorToString(Color.Empty);

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

            this.SpecialBorderColor = Tools.Drawing.ConvertColorToString(Color.Empty);
            this.NormalBorderColor  = Tools.Drawing.ConvertColorToString(Color.Empty);

            this.SpecialPadding = PaddingEx.Empty;
            this.NormalPadding  = PaddingEx.Empty;

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

            this.WatermarkAlignment = ContentAlignment.BottomRight;
        }
Beispiel #15
0
        /// <summary>
        /// Initializes a new instance of the TaskPaneInfo class with default settings
        /// </summary>
        public TaskPaneInfo()
        {
            // set background values
            this.gradientStartColor = Color.Transparent;
            this.gradientEndColor   = Color.Transparent;
            this.direction          = LinearGradientMode.Vertical;

            // set padding values
            this.padding = new PaddingEx(12, 12, 12, 12);

            // images
            this.backImage   = null;
            this.stretchMode = ImageStretchMode.Tile;

            this.watermark          = null;
            this.watermarkAlignment = ContentAlignment.BottomCenter;

            this.owner = null;
        }
        /// <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 = Tools.Drawing.ConvertColorToString(expandoInfo.SpecialBackColor);
            this.NormalBackColor  = Tools.Drawing.ConvertColorToString(expandoInfo.NormalBackColor);

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

            this.SpecialBorderColor = Tools.Drawing.ConvertColorToString(expandoInfo.SpecialBorderColor);
            this.NormalBorderColor  = Tools.Drawing.ConvertColorToString(expandoInfo.NormalBorderColor);

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

            this.SpecialBackImage = expandoInfo.SpecialBackImage.ToByteArray();
            this.NormalBackImage  = expandoInfo.NormalBackImage.ToByteArray();

            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 = (PaddingEx)info.GetValue("SpecialPadding", typeof(PaddingEx));
            this.NormalPadding  = (PaddingEx)info.GetValue("NormalPadding", typeof(PaddingEx));

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

            this.WatermarkAlignment = (ContentAlignment)info.GetValue("WatermarkAlignment", typeof(ContentAlignment));
        }
Beispiel #18
0
        /// <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 = PaddingEx.Empty;
            this.normalPadding  = PaddingEx.Empty;

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

            this.watermarkAlignment = ContentAlignment.BottomRight;
        }
Beispiel #19
0
        /// <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 PaddingEx(12, 10, 12, 10);
            this.normalPadding  = new PaddingEx(12, 10, 12, 10);

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

            this.watermarkAlignment = ContentAlignment.BottomRight;

            this.owner = null;
        }