public BitmapImage showSingleFrm(UInt16 frm) { this.Row.Content = $"{frm}"; int height = ImageInfo.dtImgInfo.Rows.Count; if (frm < height) { Bitmap bmp = BmpOper.MakeFrameImage(frm, height); MemoryStream ms = new MemoryStream(); bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); BitmapImage bmpSource = new BitmapImage(); bmpSource.BeginInit(); bmpSource.StreamSource = ms; bmpSource.EndInit(); ImageSingleFrm.Source = bmpSource; return(bmpSource); } ImageSingleFrm.Source = null; return(null); }
/// <summary> /// 生成单帧图像并绑定Image控件 /// </summary> /// <param name="frm">帧号</param> public void showSingleFrm(UInt16 frm) { txtSetFrame.Text = frm.ToString(); int height = ImageInfo.dtImgInfo.Rows.Count; frm = Convert.ToUInt16(frm - ImageInfo.startFrm); if (frm < height) { Bitmap bmp = BmpOper.MakeFrameImage(frm, height); MemoryStream ms = new MemoryStream(); bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); BitmapImage bmpSource = new BitmapImage(); bmpSource.BeginInit(); bmpSource.StreamSource = ms; bmpSource.EndInit(); ImageSingleFrm.Source = bmpSource; return; } ImageSingleFrm.Source = null; return; }