给Image.Source赋值
wpf中不能直接给路径真的很郁闷!
using System.Windows.Interop;
using System.Drawing;
将System.Drawing.Image对象作为图源:
wpfImg1.Source = Imaging.CreateBitmapSourceFromHBitmap(((Bitmap)Image01).GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
将资源中的图形作为图源:
wpfImg2.Source = Imaging.CreateBitmapSourceFromHBitmap(Properties.Resources.background.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());