override public void saveXML(SVXml xml) { XmlElement gif = xml.createNode(this.GetType().Name); gif.SetAttribute("ID", _attrib.ID.ToString()); gif.SetAttribute("X", _attrib.Rect.X.ToString()); gif.SetAttribute("Y", _attrib.Rect.Y.ToString()); gif.SetAttribute("Width", _attrib.Rect.Width.ToString()); gif.SetAttribute("Height", _attrib.Rect.Height.ToString()); ///出错图片保存 gif.SetAttribute("ErrorFile", _attrib.PicError.ImageFileName); gif.SetAttribute("ErrorShowName", _attrib.PicError.ShowName); ///保存变量 Int32 i = 0; foreach (var name in _attrib.VarName) { XmlElement nameList = xml.crateChildNode("VarName"); gif.AppendChild(nameList); nameList.SetAttribute("VName", name); nameList.SetAttribute("VType", _attrib.VarType[i].ToString()); i++; } ///保存背景图片数据 List <SVBitmap> list = _attrib.Pic.imageArray(); foreach (var item in list) { XmlElement picList = xml.crateChildNode("PIC"); gif.AppendChild(picList); picList.SetAttribute("Name", item.ShowName); picList.SetAttribute("File", item.ImageFileName); } }
/// <summary> /// 保存数据到xml文件中 /// </summary> /// <param Name="xml">xml文件对象</param> override public void saveXML(SVXml xml) { XmlElement curve = xml.createNode(this.GetType().Name); curve.SetAttribute("ID", _attrib.ID.ToString()); curve.SetAttribute("X", _attrib.Rect.X.ToString()); curve.SetAttribute("Y", _attrib.Rect.Y.ToString()); curve.SetAttribute("Width", _attrib.Rect.Width.ToString()); curve.SetAttribute("Height", _attrib.Rect.Height.ToString()); curve.SetAttribute("FrontColor", _attrib.FrontColor.ToArgb().ToString()); curve.SetAttribute("BackgdColor", _attrib.BackgdColor.ToArgb().ToString()); curve.SetAttribute("Interval", _attrib.Interval.ToString()); curve.SetAttribute("Font", _attrib.Font.Name.ToString()); curve.SetAttribute("FontSize", _attrib.Font.Size.ToString()); curve.SetAttribute("Max", _attrib.Max.ToString()); curve.SetAttribute("Min", _attrib.Min.ToString()); curve.SetAttribute("Count", _attrib.Variable.Count.ToString()); ///保存变量的字段 foreach (var varTmp in _attrib.Variable) { XmlElement nameList = xml.crateChildNode("VarName"); curve.AppendChild(nameList); nameList.SetAttribute("Value", varTmp.Var.VarName); XmlElement typeList = xml.crateChildNode("VarType"); curve.AppendChild(typeList); typeList.SetAttribute("Value", varTmp.Var.VarBlockType.ToString()); XmlElement colorList = xml.crateChildNode("VarColor"); curve.AppendChild(colorList); colorList.SetAttribute("Value", varTmp.Color.ToArgb().ToString()); XmlElement enableList = xml.crateChildNode("varEnabled"); curve.AppendChild(enableList); enableList.SetAttribute("Value", varTmp.Enabled.ToString()); } }
/// <summary> /// 保存当前按钮内容到xml文件中 /// </summary> /// <param Name="xml">xml对象</param> override public void saveXML(SVXml xml) { XmlElement button = xml.createNode(this.GetType().Name); button.SetAttribute("id", _attrib.ID.ToString()); button.SetAttribute("x", _attrib.Rect.X.ToString()); button.SetAttribute("y", _attrib.Rect.Y.ToString()); button.SetAttribute("width", _attrib.Rect.Width.ToString()); button.SetAttribute("height", _attrib.Rect.Height.ToString()); ///循环保存图片数组 List <SVBitmap> list = _attrib.BitMapArray.imageArray(); foreach (var item in list) { XmlElement picList = xml.crateChildNode("PIC"); button.AppendChild(picList); picList.SetAttribute("Name", item.ShowName); picList.SetAttribute("File", item.ImageFileName); } }