读书人

字符串怎么转成图片

发布时间: 2012-09-13 09:51:53 作者: rapoo

字符串如何转成图片?

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

读书人网 >C#

热点推荐