Files
ClientServerProject/软件系统客户端Wpf/AppWpfHelper.cs

36 lines
1006 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;
namespace Wpf
{
/***********************************************************************************
*
* 说明用于开发一些wpf专有的方法一些转换方法
*
***********************************************************************************/
public class AppWpfHelper
{
public static BitmapImage TranslateImageToBitmapImage(System.Drawing.Bitmap bitmap)
{
System.IO.MemoryStream ms = new System.IO.MemoryStream();
if(bitmap.RawFormat != null) bitmap.Save(ms, bitmap.RawFormat);
else bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.StreamSource = ms;
bi.EndInit();
return bi;
}
}
}