当前位置: 代码迷 >> 综合 >> WPF(VB.NET) ImageSource 转 System.Drawing.Image
  详细解决方案

WPF(VB.NET) ImageSource 转 System.Drawing.Image

热度:60   发布时间:2024-01-15 21:48:04.0
  Private Function ImageSourceConvertToGDI() As System.Drawing.Image
        Dim stream As New MemoryStream() '内存流
        Dim encoder As New System.Windows.Media.Imaging.BmpBitmapEncoder() '图形编码器
        encoder.Frames.Add(System.Windows.Media.Imaging.BitmapFrame.Create(ImageSourceObj)) 'ImageSource对象
        encoder.Save(stream) '写入内存流
        stream.Flush() '刷新
        Return System.Drawing.Image.FromStream(stream) ‘传回Drawing.Image
    End Function
  相关解决方案