1 /// <summary>
2 /// 读取图片文件
3 /// </summary>
4 /// <param name="path">图片文件路径</param>
5 /// <returns>图片文件</returns>
6 private Bitmap ReadImageFile(String path)
7 {
8 Bitmap bitmap=null;
9 try
10 {
11 FileStream fileStream = File.OpenRead(path);
12 Int32 filelength = 0;
13 filelength = (int)fileStream.Length;
14 Byte[] image = new Byte[filelength];
15 fileStream.Read(image, 0, filelength);
16 System.Drawing.Image result = System.Drawing.Image.FromStream(fileStream);
17 fileStream.Close();
18 bitmap = new Bitmap(result);
19 }
20 catch (Exception ex)
21 {
22 // 异常输出
23 }
24 return bitmap;
25 }