- 积分
- 40165
- 好友
- 记录
- 主题
- 帖子
- 听众
- 收听
|
我们先来看看怎么转成Byte吧,其实就一个方法,大家看代码
[code=csharp] /// <summary>
/// 字符串转16进制字节数组
/// </summary>
/// <param name="hexString"></param>
/// <returns></returns>
private static byte[] strToToHexByte(string hexString)
{
hexString = hexString.Replace(" ", "");
if ((hexString.Length % 2) != 0)
hexString += " ";
byte[] returnBytes = new byte[hexString.Length / 2];
for (int i = 0; i < returnBytes.Length; i++)
returnBytes = Convert.ToByte(hexString.Substring(i * 2, 2), 16);
return returnBytes;
} [/code]
直接调用就行了
如要转在图片其实也是先转成字符数组然后再转在图片,转成图片的方法大家看这里
http://www.sufeinet.com/thread-1913-1-1.html
|
|