解决WPF通过Image显示的图片没办法删除

来源:互联网 发布:网络公益众筹议论文 编辑:程序博客网 时间:2024/04/20 09:23
using (MemoryStream ms = new MemoryStream(File.ReadAllBytes(path)))                {                    imageSource = new BitmapImage();                    imageSource.BeginInit();                    imageSource.CacheOption = BitmapCacheOption.OnLoad;//设置缓存模式                    imageSource.StreamSource = ms;//通过StreamSource加载图片                    imageSource.EndInit();                    imageSource.Freeze();                    ImgViewer.Source = imageSource;                }


0 0