怎麼能認爲這個代碼在這裏做轉換的圖像?如何從文件夾中定義的圖像是在有bin文件夾「CH/1.JPG」任何一個可以幫助我解決這個問題? 我有20張圖片和20種形式...如何在使用此加密代碼的表單中添加圖像鏈接?
private static byte[] ConvertImageToByteArray(System.Drawing.Image imageToConvert,
ImageFormat formatOfImage)
{
byte[] Ret;
try
{
using (MemoryStream ms = new MemoryStream())
{
imageToConvert.Save(ms,formatOfImage);
Ret = ms.ToArray();
}
}
catch (Exception) { throw;}
return Ret;
}
//When you are ready to convert the byte array back
//to an image, you can include the following code
//in your method.
System.Drawing.Image newImage;
using (MemoryStream ms = new MemoryStream(myByteArray,0,myByteArray.Length))
{
ms.Write(myByteArray,0,myByteArray.Length);
newImage = Image.FromStream(ms,true);
// work with image here.
// You'll need to keep the MemoryStream open for
// as long as you want to work with your new image.
}
我很抱歉,但我不明白的問題,所有..不知道該問什麼.. – 2014-09-30 07:38:43
我問我怎麼可以添加在這個圖像,我怎麼能在形式上顯示圖像? – BuschJoe 2014-09-30 07:41:09