public void WriteXml(XmlWriter writer) { TypeConverter ffc = TypeDescriptor.GetConverter(typeof(FontFamily)); TypeConverter fsc = TypeDescriptor.GetConverter(typeof(FontStyle)); TypeConverter fwc = TypeDescriptor.GetConverter(typeof(FontWeight)); TypeConverter rc = TypeDescriptor.GetConverter(typeof(Rect)); writer.WriteElementString("FontFamily", ffc.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, FontFamily)); writer.WriteElementString("FontStyle", fsc.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, FontStyle)); writer.WriteElementString("FontWeight", fwc.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, FontWeight)); writer.WriteElementString("FontSize", FontSize.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("HorizontalAlignment", HorizontalAlignment.ToString()); writer.WriteElementString("VerticalAlignment", VerticalAlignment.ToString()); writer.WriteStartElement("Padding"); writer.WriteElementString("Left", PaddingLeft.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("Top", PaddingTop.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("Right", PaddingRight.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("Bottom", PaddingBottom.ToString(CultureInfo.InvariantCulture)); writer.WriteEndElement(); if (Decorations.HasFlag(Helios.TextDecorations.Underline)) { writer.WriteStartElement("Underline"); writer.WriteEndElement(); } if (Decorations.HasFlag(Helios.TextDecorations.Strikethrough)) { writer.WriteStartElement("Strikethrough"); writer.WriteEndElement(); } if (Decorations.HasFlag(Helios.TextDecorations.Baseline)) { writer.WriteStartElement("Baseline"); writer.WriteEndElement(); } if (Decorations.HasFlag(Helios.TextDecorations.OverLine)) { writer.WriteStartElement("OverLine"); writer.WriteEndElement(); } }
protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver) { base.FillStyleAttributes(attributes, urlResolver); if (PaddingTop != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.PaddingTop, PaddingTop.ToString()); } if (PaddingLeft != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.PaddingLeft, PaddingLeft.ToString()); } if (PaddingRight != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.PaddingRight, PaddingRight.ToString()); } if (PaddingBottom != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.PaddingBottom, PaddingBottom.ToString()); } if (MarginTop != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.MarginTop, MarginTop.ToString()); } if (MarginLeft != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.MarginLeft, MarginLeft.ToString()); } if (MarginRight != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.MarginRight, MarginRight.ToString()); } if (MarginBottom != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.MarginBottom, MarginBottom.ToString()); } if (!String.IsNullOrEmpty(BackImageUrl)) { attributes.Add(HtmlTextWriterStyle.BackgroundImage, String.Format("url({0})", urlResolver.ResolveClientUrl(BackImageUrl))); } }
protected override void FillStyleAttributes(CssStyleCollection attributes, IUrlResolutionService urlResolver) { base.FillStyleAttributes(attributes, urlResolver); if (PaddingTop != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.PaddingTop, PaddingTop.ToString()); } if (PaddingLeft != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.PaddingLeft, PaddingLeft.ToString()); } if (PaddingRight != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.PaddingRight, PaddingRight.ToString()); } if (PaddingBottom != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.PaddingBottom, PaddingBottom.ToString()); } if (MarginTop != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.MarginTop, MarginTop.ToString()); } if (MarginLeft != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.MarginLeft, MarginLeft.ToString()); } if (MarginRight != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.MarginRight, MarginRight.ToString()); } if (MarginBottom != Unit.Empty) { attributes.Add(HtmlTextWriterStyle.MarginBottom, MarginBottom.ToString()); } }