public static BitmapSource ToBitmapSource(Bitmap bitmap)
{
MemoryStream ms = new MemoryStream();
bitmap.Save(ms, ImageFormat.Png);
ms.Position = 0;
BitmapImage bi = new BitmapImage();
bi.BeginInit();
bi.StreamSource = ms;
bi.EndInit();
return bi;
}
将System.Drawing.Bitmap转换成System.Drawing.Imaging.BitmapSource
最新推荐文章于 2025-06-26 08:50:24 发布