如何在Expression Blend中显示位图图像 [英] How to Display Bitmap Images in Expression Blend
问题描述
我有一个程序可以显示从网络摄像机拍摄的图像,如本文所述,在 ^ ].它使用AForge库捕获图像,并且由于它是Windows Form应用程序,因此可以使用以下代码简单地显示图像
Hi,
I have a program that displays the images taken from the webcam as described in this article at http://irslab.blogspot.com/2010/07/webcam-using-aforgenet-part-i.html?showComment=1309837336161#comment-c7001370807997667575[^]. It uses AForge library to capture the image and since it is a Windows Form application it can simply display the image by using the following code
void camera_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
Bitmap bmp = (Bitmap)eventArgs.Frame.Clone();
//simply set the bmp as the Image in pictureBox1
pictureBox1.Image = bmp;
}
但是,当涉及到Expression Blend时,您不能对在那里找到的Image占位符执行此操作.您只能按如下方式提供图片的网址
BUT, when it comes to Expression blend, you can''t do this to the Image placeholder you find there. You can only give the url of an image as follows
imagePlaceHolder.Source = (ImageSource(newImageSourceConverter().ConvertFromString(fileName));
如何将imagePlaceHolder定向到我的位图图像??
有人请帮忙..... !!!!
在此先感谢您.
How can I direct the imagePlaceHolder to my Bitmap image???
Somebody please help.....!!!!
Thanks in advance.
推荐答案
您只能按如下所示提供图像的网址
不正确,您可以提供一个URL,也可以提供一个ImageSource
.有关如何将Bitmap
转换为BitmapSource
的信息,请参见将位图转换为BitmapSource [ ^ ]
You can only give the url of an image as follows
Not true you can give a url, and you can provide anImageSource
. For how to convert yourBitmap
to aBitmapSource
see Bitmap to BitmapSource[^]
谢谢参加解决我的问题需要付出很多,但这并不是我真正想要的.但是最近我找到了真正的解决方案.您可以简单地使用WPF应用程序在Windows.Forms.Controls中拥有的PictureBox控件.
就这么简单.要知道如何做到这一点,只需阅读代码项目文章
[
Well thanks a lot for attending to solve my issue but it is not what I really wanted. But recently I found the real solution. You can simply use the PictureBox control you have in Windows.Forms.Controls in the WPF application.
It is simple as that. To know how to do that just read the Code Project article
[
Host Windows Form Controls in WPF
]
谢谢大家.
]
Thanks all.
这篇关于如何在Expression Blend中显示位图图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!