WPF 保存image控件里的图片

原文: WPF 保存image控件里的图片

string ProImgPath = ProcessPath + name + ".png";//要保存的图片的地址,包含文件名
BitmapSource BS = (BitmapSource)ImgPro.Source;
PngBitmapEncoder PBE = new PngBitmapEncoder();
PBE.Frames.Add(BitmapFrame.Create(BS));
using (Stream stream = File.Create(ProImgPath))
{
    PBE.Save(stream);
}

猜你喜欢

转载自www.cnblogs.com/lonelyxmas/p/10789533.html