在 System.Windows.Controls.Image 控件中显示 System.Drawing.Bitmap 对象

发布于 2024-11-11 16:20:37 字数 298 浏览 6 评论 0原文

我有一个图像控件:

<Image Height="209" HorizontalAlignment="Left" Margin="66,74,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="200" />

在 wpf 应用程序中。我导入了一个将视频转换为位图图像的库,我试图将这些位图放入图像控制中。有一个方法返回 System.Drawing.Bitmap 对象,我想在 image1 中显示该位图。我怎么能这么做呢?

I have an image control as:

<Image Height="209" HorizontalAlignment="Left" Margin="66,74,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="200" />

in a wpf application. I imported a library that converts a video to bitmap images and I am trying to place those bitmaps in the image countrol. There is a method that returns a System.Drawing.Bitmap object and I want to display that bitmap in image1. How could I do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦亿 2024-11-18 16:20:37

您需要首先将其转换为某种ImageSource。请参阅此问题

您可以使用 ValueConverter 在绑定本身中动态执行此操作。

You need to convert it to an ImageSource of some kind first. See this question.

You can use a ValueConverter to do this on the fly in the binding itself.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文