this question has answer here:
- load wpf bitmapimage system.drawing.bitmap 10 answers
i used work wfa no want try wpf platform, too.
i need assign existing bitmap image control.
private void window_loaded(object sender, routedeventargs e) { bitmap sc = screenshot(); ima.source = new bitmap(sc); } this line not working: ima.source = new bitmap(sc);
in picturebox can use this
ima.image = new bitmap(sc); but throwing error:
cannot implicitly convert type 'system.drawing.bitmap' 'system.windows.media.imagesource'.
this convert path imagesource.
<image> <image.source> <bitmapimage urisource="{binding imagepath}" /> </image.source> </image> try in way.
public imagesource imagesourceforimagecontrol { { imagesourceconverter c = new imagesourceconverter(); return (imagesource)c.convertfrom(yourbitmap); } } https://msdn.microsoft.com/en-us/library/system.windows.media.imagesourceconverter(v=vs.110).aspx
Comments
Post a Comment