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); XmlElement vNode = aNode.OwnerDocument.CreateElement("img"); vNode.InnerText = HC.GraphicToBase64(FImage, FImage.RawFormat); aNode.AppendChild(vNode); vNode = aNode.OwnerDocument.CreateElement("shapes"); FShapeManager.ToXml(vNode); aNode.AppendChild(vNode); }
public override string ToHtml(string aPath) { if (aPath != "") // 保存到指定的文件夹中 { if (!Directory.Exists(aPath + "images")) { Directory.CreateDirectory(aPath + "images"); } string vFileName = OwnerData.Style.GetHtmlFileTempName() + ".bmp"; FImage.Save(aPath + "images\"" + vFileName); return("<img width=\"" + Width.ToString() + "\" height=\"" + Height.ToString() + "\" src=\"images/" + vFileName + " alt=\"HCImageItem\" />"); } else // 保存为Base64 { return("<img width=\"" + Width.ToString() + "\" height=\"" + Height.ToString() + "\" src=\"data:img/jpg;base64," + HC.GraphicToBase64(FImage, FImage.RawFormat) + "\" alt=\"HCImageItem\" />"); } }
public override void ToXml(XmlElement aNode) { base.ToXml(aNode); aNode.InnerText = HC.GraphicToBase64(FGifImage, System.Drawing.Imaging.ImageFormat.Gif); }
public override void ToXml(System.Xml.XmlElement aNode) { base.ToXml(aNode); aNode.InnerText = HC.GraphicToBase64(FImage); }