/// <summary> /// 构造函数 /// </summary> /// <param name="titleNode">字体定义节点</param> public DUIFont(XmlNode fontNode) { if (fontNode != null) { //读取基础属性 _name = XMLConfigReader.ReadString("name", fontNode.Attributes["name"]); _backColor = XMLConfigReader.ReadColor(fontNode.Name, "backColor", fontNode.Attributes["backColor"]); _foreColor = XMLConfigReader.ReadColor(fontNode.Name, "foreColor", fontNode.Attributes["foreColor"]); string _fontFamily = XMLConfigReader.ReadString("fontFamily", fontNode.Attributes["fontFamily"]); int _fontSize = XMLConfigReader.ReadInt(fontNode.Name, "fontSize", fontNode.Attributes["fontSize"]); bool _fontBold = XMLConfigReader.ReadBoolean(fontNode.Name, "fontBold", fontNode.Attributes["fontBold"]); bool _fontItalic = XMLConfigReader.ReadBoolean(fontNode.Name, "fontItalic", fontNode.Attributes["fontItalic"]); bool _fontUnderline = XMLConfigReader.ReadBoolean(fontNode.Name, "fontUnderline", fontNode.Attributes["fontUnderline"]); bool _fontStrikeout = XMLConfigReader.ReadBoolean(fontNode.Name, "fontStrikeout", fontNode.Attributes["fontStrikeout"]); //构造组合属性 try { FontFamily fontFamily = new FontFamily(_fontFamily); FontStyle fontStyle = FontStyle.Regular; fontStyle = _fontBold ? (fontStyle | FontStyle.Bold) : fontStyle; fontStyle = _fontItalic ? (fontStyle | FontStyle.Italic) : fontStyle; fontStyle = _fontUnderline ? (fontStyle | FontStyle.Underline) : fontStyle; fontStyle = _fontStrikeout ? (fontStyle | FontStyle.Strikeout) : fontStyle; _font = new Font(fontFamily, _fontSize, fontStyle); } catch { _font = null; } } }
/// <summary> /// 构造函数 /// </summary> /// <param name="titleNode">布局标题区定义节</param> public DUILayoutTitleInfo(XmlNode titleNode) { if (titleNode != null) { //读取基础属性 _iconSourceName = XMLConfigReader.ReadString("iconSourceName", titleNode.Attributes["iconSourceName"]); _showIcon = XMLConfigReader.ReadBoolean(titleNode.Name, "showIcon", titleNode.Attributes["showIcon"]); _text = XMLConfigReader.ReadString("text", titleNode.Attributes["text"]); _titleAreaHeight = XMLConfigReader.ReadInt(titleNode.Name, "titleAreaHeight", titleNode.Attributes["titleAreaHeight"]); _titleAreaOffset = XMLConfigReader.ReadInt(titleNode.Name, "titleAreaOffset", titleNode.Attributes["titleAreaOffset"]); _fontName = XMLConfigReader.ReadString("fontName", titleNode.Attributes["fontName"]); } }