int IComparer.Compare(Object x, Object y) { SVGAttribute ax = (SVGAttribute)x; SVGAttribute ay = (SVGAttribute)y; if (ax.AttributeGroup == ay.AttributeGroup) { if (ax.AttributeType < ay.AttributeType) { return(-1); } else { return(1); } } else if (ax.AttributeGroup < ay.AttributeGroup) { return(-1); } else { return(1); } }
protected string OpenXMLTag() { string sXML; sXML = "<" + m_sElementName; for (int i = 0; i < m_attributes.Count; i++) { SVGAttribute attr = (SVGAttribute)m_attributes[i]; sXML += attr.GetXML(); } if (m_sElementValue == "") { if (m_Child == null) { sXML += " />\r\n"; } else { sXML += ">\r\n"; } } else { sXML += ">"; sXML += m_sElementValue; } return(sXML); }
protected void AddAttr(SVGAttribute._SvgAttribute type, object objValue) { SVGAttribute attrToAdd = new SVGAttribute(type); attrToAdd.Value = objValue; m_attributes.Add(attrToAdd); }
internal bool SetAttributeValue(string sName, string sValue) { bool bReturn = false; for (int i = 0; i < m_attributes.Count; i++) { SVGAttribute attr = (SVGAttribute)m_attributes[i]; if (attr.Name == sName) { switch (attr.AttributeDataType) //获取属性的值所处类型,默认为字符串 { case SVGAttribute._SvgAttributeDataType.datatypeString: //跳到下一个case执行 case SVGAttribute._SvgAttributeDataType.datatypeHRef: attr.Value = sValue; if (attr.AttributeType == SVGAttribute._SvgAttribute.attrStyle_Style) { ParseStyle(sValue); } break; case SVGAttribute._SvgAttributeDataType.datatypeEnum: int nValue = 0; try { nValue = Convert.ToInt32(sValue); } catch { } attr.Value = nValue; break; case SVGAttribute._SvgAttributeDataType.datatypeColor: if (sValue == "") { attr.Value = Color.Transparent; } else { Color c = attr.String2Color(sValue); attr.Value = c; } break; } bReturn = true; break; } } return(bReturn); }
internal SVGAttribute GetAttribute(SVGAttribute._SvgAttribute type) { for (int i = 0; i < m_attributes.Count; i++) { SVGAttribute attr = (SVGAttribute)m_attributes[i]; if (attr.AttributeType == type) { return(attr); } } return(null); }
internal SVGAttribute GetAttribute(string sName) { for (int i = 0; i < m_attributes.Count; i++) { SVGAttribute attr = (SVGAttribute)m_attributes[i]; if (attr.Name == sName) { return(attr); } } return(null); }
/// <summary> /// 它获取所有元素属性。 /// </summary> public void FillAttributeList(ArrayList aType, ArrayList aName, ArrayList aValue) { IComparer myComparer = new CEleComparer(); m_attributes.Sort(myComparer); for (int i = 0; i < m_attributes.Count; i++) { SVGAttribute attr = (SVGAttribute)m_attributes[i]; aType.Add(attr.AttributeType); aName.Add(attr.Name); aValue.Add(attr.Value); } }
internal bool SetAttributeValue(SVGAttribute._SvgAttribute type, object objValue) { bool bReturn = false; for (int i = 0; i < m_attributes.Count; i++) { SVGAttribute attr = (SVGAttribute)m_attributes[i]; if (attr.AttributeType == type) { bReturn = true; attr.Value = objValue; break; } } return(bReturn); }