//nSize 为总长度
//pImageData 为总数据
//nImageSize //一个图片的长度
byte[] _bytes = new byte[nImageSize];//
//IntPtr infosIntptr = Marshal.AllocHGlobal(pImageData);
Marshal.Copy(pImageData, _bytes, 0, nImageSize);//复制
PtrMoveSize(ref pImageData, nImageSize);//丛总内存中去掉当前的图片所占内存
nSize -= nImageSize;
MemoryStream ms = new MemoryStream(_bytes);
Image img = Image.FromStream(ms);
ms.Close();
ms.Dispose();
pictureBox1.Image = img;
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
//指针偏移
public static void PtrMoveSize(ref IntPtr pData, int nLength)
{
if (IntPtr.Size == sizeof(Int64))
pData = new IntPtr(pData.ToInt64() + nLength);
else
pData = new IntPtr(pData.ToInt32() + nLength);
}