Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BitmapSource as source to Image Control

I have this

BitmapSource  source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(bitmap.GetHbitmap(),
IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());

How I can use it to apply as source for WPF Image somehow?

Please provide code sample.

Thank you!

like image 834
Friend Avatar asked Jul 23 '26 06:07

Friend


1 Answers

BitmapSource derives from ImageSource, so you can assign it directly to the Source property of an Image.

like image 180
dlev Avatar answered Jul 24 '26 18:07

dlev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!