public override void Deserialize(Version documentVersion, XmlElement node) { base.Deserialize(documentVersion, node); BackColor = ST.DeserializeColor(node, "back_color", BackColor); ForeColor = ST.DeserializeColor(node, "fore_color", ForeColor); LineColor = ST.DeserializeColor(node, "line_color", LineColor); BorderColor = ST.DeserializeColor(node, "border_color", BorderColor); Shape = ST.GetTopicShape(ST.ReadTextNode(node, "shape"), TopicShape.Default); RoundRadius = ST.GetInt(ST.ReadTextNode(node, "round_radius"), TopicStyle.DefaultRoundRadius); TextAlignment = ST.GetEnumValue(ST.ReadTextNode(node, "text_align"), HorizontalAlignment.Center); FillType = ST.ReadTextNode(node, "fill_type"); Padding?padding = ST.GetPadding(ST.ReadTextNode(node, "padding")); if (padding.HasValue) { Padding = padding.Value; } else { Padding = new Padding(TopicStyle.DefaultNodePadding); } XmlElement fontNode = node.SelectSingleNode("font") as XmlElement; if (fontNode != null) { Font = ST.ReadFontNode(fontNode); } }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { Padding?padding = ST.GetPadding((string)value); if (padding.HasValue) { return(padding.Value); } } return(base.ConvertFrom(context, culture, value)); }