c# - Show Drawing.Image in WPF -
i´ve got instance of system.drawing.image.
how can show in wpf-application?
i tried img.source
not work.
i have same problem , solve combining several answers.
system.drawing.bitmap bmp; image image; ... using (var ms = new memorystream()) { bmp.save(ms, system.drawing.imaging.imageformat.png); ms.position = 0; var bi = new bitmapimage(); bi.begininit(); bi.cacheoption = bitmapcacheoption.onload; bi.streamsource = ms; bi.endinit(); } image.source = bi; //bmp.dispose(); //if bmp not used further. @peter
Comments
Post a Comment