Пример #1
0
        public override void WriteXml(XmlWriter writer)
        {
            base.WriteXml(writer);

            TypeConverter cc = TypeDescriptor.GetConverter(typeof(Color));
            TypeConverter bc = TypeDescriptor.GetConverter(typeof(bool));

            writer.WriteStartElement("Background");
            if (FillBackground)
            {
                writer.WriteElementString("Color", cc.ConvertToInvariantString(BackgroundColor));
            }
            if (!string.IsNullOrWhiteSpace(BackgroundImage))
            {
                writer.WriteElementString("Image", BackgroundImage);
                writer.WriteElementString("ImageAlignment", BackgroundAlignment.ToString());
            }
            writer.WriteEndElement();

            if (DrawBorder)
            {
                writer.WriteStartElement("Border");
                writer.WriteElementString("TopLeftCorner", TopLeftCornerImage);
                writer.WriteElementString("TopBorder", TopBorderImage);
                writer.WriteElementString("TopRightCorner", TopRightCornerImage);
                writer.WriteElementString("RightBorder", RightBorderImage);
                writer.WriteElementString("BottomRightCorner", BottomRightCornerImage);
                writer.WriteElementString("BottomBorder", BottomBorderImage);
                writer.WriteElementString("BottomLeftCorner", BottomLeftCornerImage);
                writer.WriteElementString("LeftBorder", LeftBorderImage);
                writer.WriteEndElement();
            }
        }
Пример #2
0
        public override void WriteXml(XmlWriter writer)
        {
            TypeConverter cc = TypeDescriptor.GetConverter(typeof(Color));
            TypeConverter bc = TypeDescriptor.GetConverter(typeof(bool));

            base.WriteXml(writer);

            writer.WriteElementString("Orientation", Orientation.ToString());
            writer.WriteElementString("AlwaysOnTop", bc.ConvertToInvariantString(AlwaysOnTop));

            writer.WriteStartElement("Background");
            if (!string.IsNullOrWhiteSpace(BackgroundImage))
            {
                writer.WriteElementString("Image", BackgroundImage);
                writer.WriteElementString("ImageAlignment", BackgroundAlignment.ToString());
            }

            if (FillBackground)
            {
                writer.WriteElementString("Color", cc.ConvertToInvariantString(BackgroundColor));
            }
            writer.WriteEndElement();
        }