Convert a Fuckin old School System.Drawing.Image in a Beautiful new System.Windows.Controls.Image ;)
viel spaß damit ;)
/// <summary>
/// Convert a Fuckin old School System.Drawing.Image in a Beautiful
/// new System.Windows.Controls.Image ;)
/// </summary>
/// <param name="Old_School_Image"></param>
/// <returns></returns>
public static System.Windows.Controls.Image WFormsImageToWPFImage(System.Drawing.Image Old_School_Image)
{
MemoryStream ms = new MemoryStream();
Old_School_Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
System.Windows.Media.Imaging.BitmapImage bImg = new System.Windows.Media.Imaging.BitmapImage();
bImg.BeginInit();
bImg.StreamSource = new MemoryStream(ms.ToArray());
bImg.EndInit();
System.Windows.Controls.Image WPFImage = new System.Windows.Controls.Image();
WPFImage.Source = bImg;
return WPFImage;
}
2 Kommentare zum Snippet