首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

字符串怎么转成图片

2012-09-13 
字符串如何转成图片?C# codepublic static byte[] BitmapToByte(Bitmap A_0){if (A_0 null){return nul

字符串如何转成图片?

C# code
    public static byte[] BitmapToByte(Bitmap A_0)    {        if (A_0 == null)        {            return null;        }        BitmapData bitmapdata = A_0.LockBits(new Rectangle(new System.Drawing.Point(), A_0.Size), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);        int length = bitmapdata.Stride * A_0.Height;        byte[] destination = new byte[length];        Marshal.Copy(bitmapdata.Scan0, destination, 0, length);        A_0.UnlockBits(bitmapdata);        return destination;    }    public static string ByteToStr(byte[] A_0)    {        if (A_0 == null)        {            return "";        }        string str = "";        if (A_0 != null)        {            for (int i = 0; i < A_0.Length; i++)            {                str = str + A_0[i].ToString("X2");            }        }        return str;    }

图片转化成字符串,是上面这样,但如何从得到的字符串转化回去呢??

[解决办法]
http://hi.baidu.com/caodeliliang/item/a6cef910ac5b77081994ec8e

热点排行