imageControl.Source = this.GetBitmapImage(imagePath);//imageControl为WPF Image控件

  

public BitmapImage GetBitmapImage(string imagePath)
{
            BitmapImage bitmap = new BitmapImage();
            bitmap.BeginInit();
            bitmap.CacheOption = BitmapCacheOption.OnLoad;
            bitmap.UriSource = new Uri(imagePath);
            bitmap.EndInit();
            return bitmap.Clone();
}

  

相关文章:

  • 2021-05-25
  • 2021-06-22
  • 2022-12-23
  • 2022-12-23
  • 2021-09-20
  • 2022-12-23
  • 2021-04-13
猜你喜欢
  • 2022-12-23
  • 2021-10-10
  • 2021-05-04
  • 2022-12-23
  • 2022-12-23
  • 2022-01-25
  • 2022-12-23
相关资源
相似解决方案