/// <summary>
/// 64位字符到图像
/// </summary>
/// <param name="image"></param>
/// <returns></returns>
private System.Drawing.Image Base64StringToImage(string data)
{
if (data == "")
{
return null;
}
try
{
byte[] img = Convert.FromBase64String(data);
MemoryStream ms = new MemoryStream(img);
System.Drawing.Image image = System.Drawing.Image.FromStream(ms);
return image;
}
catch
{
return null;
}
}
/// <summary>
/// 图像到64位字符
/// </summary>
/// <param name="image"></param>
/// <returns></returns>
private string ImageToBase64String(System.Drawing.Image image)
{
if (image == null)
{
return "";
}
try
{
MemoryStream ms = new MemoryStream();
if (image.RawFormat.Guid ==System.Drawing.Imaging.ImageFormat.Icon.Guid)
{
Icon icon = Icon.FromHandle(((Bitmap)image).GetHicon());
icon.Save(ms);
}
  |