【问题标题】:display a System.Drawing.Bitmap object in a System.Windows.Controls.Image control在 System.Windows.Controls.Image 控件中显示 System.Drawing.Bitmap 对象
【发布时间】:2011-06-04 02:41:31
【问题描述】:

我有一个图像控件:

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

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

【问题讨论】:

  • 您需要将该位图转换为 XAML 兼容位图。

标签: c# wpf image xaml bitmapimage


【解决方案1】:

您需要先将其转换为某种ImageSource。见this question。

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

【讨论】:

    猜你喜欢
    • 2010-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-23
    • 2021-02-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多