/// <summary> /// 已重载:保存对象数据到XML节点 /// </summary> /// <param name="myElement">XML节点</param> /// <returns>操作是否成功</returns> public override bool ToXML(System.Xml.XmlElement myElement) { switch (myOwnerDocument.Info.SaveMode) { case 0: // 保存所有数据 if (myImage != null) { if (myImage.Size.Width != intWidth) { myAttributes.SetValue(ZYTextConst.c_Width, intWidth.ToString()); } else { myAttributes.RemoveAttribute(ZYTextConst.c_Width); } if (myImage.Size.Height != intHeight) { myAttributes.SetValue(ZYTextConst.c_Height, intHeight.ToString()); } else { myAttributes.RemoveAttribute(ZYTextConst.c_Height); } } myAttributes.ToXML(myElement); if (this.SaveInFile && myImage != null) { if (string.IsNullOrEmpty(imagecontent)) { myElement.InnerText = StringCommon.ImageToBase64String(myImage, System.Drawing.Imaging.ImageFormat.Png); } //todo else { myElement.InnerText = imagecontent; } } return(true); case 1: // 只保存文本数据 break; case 2: // 只保存结构化数据 break; } return(false); }