/// <summary> /// Creates a new instance of <see cref="HighlightColor"/> /// </summary> public HighlightColor(XmlElement el, HighlightColor defaultColor) { Debug.Assert(el != null, "VCI.XmlEditor.Document.SyntaxColor(XmlElement el) : el == null"); if (el.Attributes["bold"] != null) { bold = Boolean.Parse(el.Attributes["bold"].InnerText); } else { bold = defaultColor.Bold; } if (el.Attributes["italic"] != null) { italic = Boolean.Parse(el.Attributes["italic"].InnerText); } else { italic = defaultColor.Italic; } if (el.Attributes["color"] != null) { string c = el.Attributes["color"].InnerText; if (c[0] == '#') { color = ParseColor(c); } else if (c.StartsWith("SystemColors.")) { color = ParseColorString(c.Substring("SystemColors.".Length)); } else { color = (Color)(Color.GetType()).InvokeMember(c, BindingFlags.GetProperty, null, Color, new object[0]); } hasForeground = true; } else { color = defaultColor.color; } if (el.Attributes["bgcolor"] != null) { string c = el.Attributes["bgcolor"].InnerText; if (c[0] == '#') { backgroundcolor = ParseColor(c); } else if (c.StartsWith("SystemColors.")) { backgroundcolor = ParseColorString(c.Substring("SystemColors.".Length)); } else { backgroundcolor = (Color)(Color.GetType()).InvokeMember(c, BindingFlags.GetProperty, null, Color, new object[0]); } hasBackground = true; } else { backgroundcolor = defaultColor.BackgroundColor; } }