Winform图像控件 [英] Winform Image Control
本文介绍了Winform图像控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我将代码从WPF转换为Winforms。 winforms是否具有Image控件而不是图片框图像。 WPF有一个Image控件,我试图捕获一个图像。我在尝试下面的代码时遇到错误。
I convert code from WPF to Winforms. Does winforms have an Image control instead of a picture box image. WPF has an Image control where I am trying to capture an image. I am getting an error trying on the code below.
错误:您无法将System.Windows.Media.ImageSource转换为PictureBox。如何在winforms中实现这一目标
Error: you cannot convert System.Windows.Media.ImageSource to PictureBox. How to achieve this in winforms
pbImage.Image =( ImageSource )ImageSource;
pbImage.Image = (ImageSource)ImageSource;
pianoboyCoder
pianoboyCoder
推荐答案
System.IO.MemoryStream ms = new System.IO.MemoryStream();
BmpBitmapEncoder encoder = new BmpBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create((BitmapSource)_imagesource));
encoder.Save(ms);
Bitmap bp = new Bitmap(ms);
ms.Close();
像这样使用
这篇关于Winform图像控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文