public override string ToHtml(string aPath) { Bitmap vBitmap = null; if (!this.SaveToBitmap(ref vBitmap)) { return(""); } string Result = ""; if (aPath != "") { if (!Directory.Exists(aPath + "images")) { Directory.CreateDirectory(aPath + "images"); } string vFileName = OwnerData.Style.GetHtmlFileTempName() + ".bmp"; vBitmap.Save(aPath + "images\\" + vFileName); Result = "<img width=\"" + FWidth.ToString() + "\" height=\"" + FHeight.ToString() + "\" src=\"images/" + vFileName + "\" alt=\"" + this.GetType().Name + "\" />"; } else // 保存为Base64 { Result = "<img width=\"" + FWidth.ToString() + "\" height=\"" + FHeight.ToString() + "\" src=\"data:img/jpg;base64," + HC.GraphicToBase64(vBitmap) + "\" alt=\"THCImageItem\" />"; } return(Result); }
public override void ToXml(XmlElement aNode) { base.ToXml(aNode); aNode.SetAttribute("width", FWidth.ToString()); aNode.SetAttribute("height", FHeight.ToString()); }
public override void ToXml(XmlElement aNode) { base.ToXml(aNode); aNode.Attributes["width"].Value = FWidth.ToString(); aNode.Attributes["height"].Value = FHeight.ToString(); }