Beispiel #1
0
 /// <summary>
 /// Initialize new default instance.
 /// </summary>
 public AppearanceBar()
 {
     backStyle = new ColorPair();
     backStyle.AppearanceChanged        += OnAppearanceChanged;
     appearanceBorder                    = new AppearanceBorder();
     appearanceBorder.AppearanceChanged += OnAppearanceChanged;
     Reset();
 }
        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>A new object that is a copy of this instance.</returns>
        public virtual object Clone()
        {
            var appearanceBorder = new AppearanceBorder();

            appearanceBorder.CornerShape.Assign((CornerShape)cornerShape.Clone());
            appearanceBorder.BorderLineStyle  = borderLineStyle;
            appearanceBorder.BorderVisibility = borderVisibility;
            return(appearanceBorder);
        }
Beispiel #3
0
        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>A new object that is a copy of this instance.</returns>
        public object Clone()
        {
            var app = new AppearanceBar();

            app.BackStyle.Assign((ColorPair)BackStyle.Clone());
            app.AppearanceBorder.Assign((AppearanceBorder)AppearanceBorder.Clone());
            app.CornerRadius  = CornerRadius;
            app.DisabledMask  = DisabledMask;
            app.FocusedBorder = FocusedBorder;
            app.NormalBorder  = NormalBorder;
            return(app);
        }
Beispiel #4
0
        /// <summary>
        /// Converts an object into its XML representation.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Xml.XmlWriter" /> stream to which the object is serialized.</param>
        public void WriteXml(XmlWriter writer)
        {
            writer.WriteStartElement("BackStyle");
            BackStyle.WriteXml(writer);
            writer.WriteEndElement();

            writer.WriteElementString("NormalBorder", PaintUtility.GetString(NormalBorder));
            writer.WriteElementString("DisabledMask", PaintUtility.GetString(DisabledMask));
            writer.WriteElementString("FocusedBorder", PaintUtility.GetString(FocusedBorder));

            writer.WriteStartElement("AppearanceBorder");
            AppearanceBorder.WriteXml(writer);
            writer.WriteEndElement();

            writer.WriteElementString("CornerRadius", CornerRadius.ToString());
        }
Beispiel #5
0
        /// <summary>
        /// Generates an object from its XML representation.
        /// </summary>
        /// <param name="reader">The <see cref="T:System.Xml.XmlReader" /> stream from which the object is deserialized.</param>
        public void ReadXml(XmlReader reader)
        {
            var doc = new XmlDocument();

            doc.Load(reader);

            if (doc.GetElementsByTagName("BackStyle").Count > 0)
            {
                var xml = "<ColorPair>" + doc.GetElementsByTagName("BackStyle")[0].InnerXml + "</ColorPair>";
                BackStyle.ReadXml(new XmlTextReader(xml, XmlNodeType.Document, null));
            }
            if (doc.GetElementsByTagName("NormalBorder").Count > 0)
            {
                NormalBorder = PaintUtility.GetColor(doc.GetElementsByTagName("NormalBorder")[0].InnerText);
            }

            if (doc.GetElementsByTagName("DisabledMask").Count > 0)
            {
                DisabledMask = PaintUtility.GetColor(doc.GetElementsByTagName("DisabledMask")[0].InnerText);
            }

            if (doc.GetElementsByTagName("FocusedBorder").Count > 0)
            {
                FocusedBorder = PaintUtility.GetColor(doc.GetElementsByTagName("FocusedBorder")[0].InnerText);
            }

            if (doc.GetElementsByTagName("AppearanceBorder").Count > 0)
            {
                var xml = "<AppearanceBorder>" + doc.GetElementsByTagName("AppearanceBorder")[0].InnerXml +
                          "</AppearanceBorder>";
                AppearanceBorder.ReadXml(new XmlTextReader(xml, XmlNodeType.Document, null));
            }

            if (doc.GetElementsByTagName("CornerRadius").Count > 0)
            {
                CornerRadius = Convert.ToInt32(doc.GetElementsByTagName("CornerRadius")[0].InnerText);
            }
        }
 /// <summary>
 /// Copies values of supplied <see cref="AppearanceBorder" /> to current object.
 /// </summary>
 /// <param name="appearanceBorder"><see cref="AppearanceBorder" /> object whose value is to be copied.</param>
 public void Assign(AppearanceBorder appearanceBorder)
 {
     CornerShape.Assign((CornerShape)appearanceBorder.cornerShape.Clone());
     BorderLineStyle  = appearanceBorder.borderLineStyle;
     BorderVisibility = appearanceBorder.borderVisibility;
 }