VB.net Wpf用户控件访问资源图像(资源图像)

时间:2011-07-25 09:26:16

标签: vb.net wpf-controls

此普通图像转换窗口媒体图像功能

Private Function Bmp2MediaImage(ByVal Resourceimage As System.Drawing.Bitmap) As System.Windows.Media.ImageSource
Dim bmp As System.Drawing.Bitmap = New System.Drawing.Bitmap(Resourceimage)
Dim hBitmap As IntPtr = bmp.GetHbitmap
Dim imageSource As System.Windows.Media.ImageSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions)
Return imageSource
End Function

保重

0 个答案:

没有答案