System.Byte[] IamageCount;
Image img;
priavte void ReadPic()
{
string FileName=图片路径;
if(this.JudgeFile(FileName)==false )
{
MessageBox.Show("找不到图像文件!","消息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
FileStream ImageStream= new FileStream(FileName,FileMode.Open,FileAccess.Read); //文件流
int ImageLength =Convert.ToInt32(ImageStream.Length);
this.IamgeCount =new Byte[ImageLength];
this.img =Image.FromStream(ImageStream);
this.picR4.Image=this.img;
}
/// <summary>
/// 判断图像文件是否存在该路径中
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
private bool JudgeFile(string fileName)
{
if(File.Exists(fileName)==true )
{
return true;
}
else
{
return false;
}
}