/// <summary> /// 用于处理IZKFPEngXEvents_OnImageReceivedEvent事件 /// 抛出:指纹仪未初始化 异常 /// </summary> /// <param name="e">IZKFPEngXEvents_OnImageReceivedEvent事件</param> /// <param name="fingerprintDevice">指纹设备(如:AxZKFPEngX1)</param> /// <returns>一个System.Image</returns> public static Image GetFingerprintImage(IZKFPEngXEvents_OnImageReceivedEvent e, AxZKFPEngX fingerprintDevice) { if (fingerprintDevice == null) { throw new ArgumentNullException("fingerprintDevice"); } if (!e.aImageValid) { return(null); } #pragma warning disable 642 if (File.Exists("temp.bmp")) { ; } #pragma warning restore 642 { File.Delete("temp.bmp"); } try { fingerprintDevice.SaveBitmap("temp.bmp"); } catch (Exception ex) { MessageBox.Show(ex.Message); throw; } #pragma warning disable 642 #pragma warning restore 642 { var file = FileContent("temp.bmp"); var ms = new MemoryStream(file) { Position = 0 }; File.Delete("temp.bmp"); return(Image.FromStream(ms)); } }