我尝试使用Image
。它运作良好但有时我得到“参数无效”例外。我不知道为什么会出现这个问题,请帮助我:
byte[] img = (byte[])PatientData.Rows[index - 1]["Anh"];
MemoryStream ms = new MemoryStream(img);
imgBox.Image.Dispose();
imgBox.Image = Image.FromStream(ms);
using (Bitmap abc = new Bitmap(imgBox.Image)) //Parameter is not valid (Sometimes)
{
using (Image<Gray, byte> xyz = new Image<Gray, byte>(abc))
{
if(Global.xrayPic != null)
{
Global.xrayPic.Dispose();
Global.xrayPic = xyz.Clone();
}
}
}
当我检查它时,我意识到abc
== null的值,它会导致此异常。我该如何解决这种情况?