//Createsource BitmapImagemyBitmapImage= new BitmapImage(); 
//BitmapImage.UriSourcemustbeinaBeginInit/EndInitblock 
myBitmapImage.BeginInit(); myBitmapImage.UriSource= new 
Uri(str,UriKind.Absolute); 
//Tosavesignificantapplicationmemory,settheDecodePixelWid

// Create source BitmapImage myBitmapImage = new BitmapImage(); // BitmapImage.UriSource must be in a BeginInit/EndInit block myBitmapImage.BeginInit(); myBitmapImage.UriSource = new Uri(str, UriKind.Absolute); // To save significant application memory, set the DecodePixelWidth or // DecodePixelHeight of the BitmapImage value of the image source to the desired // height or width of the rendered image. If you don't do this, the application will // cache the image as though it were rendered as its normal size rather then just // the size that is displayed. // Note: In order to preserve aspect ratio, set DecodePixelWidth // or DecodePixelHeight but not both. myBitmapImage.DecodePixelWidth = 2048; myBitmapImage.EndInit(); //set image source Image img = new Image(); img.Source = myBitmapImage;

 

// Create source   
BitmapImage myBitmapImage = new BitmapImage();   
   
   
// BitmapImage.UriSource must be in a BeginInit/EndInit block   
myBitmapImage.BeginInit();   
myBitmapImage.UriSource = new Uri(str, UriKind.Absolute);   
   
   
// To save significant application memory, set the DecodePixelWidth or     
// DecodePixelHeight of the BitmapImage value of the image source to the desired    
// height or width of the rendered image. If you don't do this, the application will    
// cache the image as though it were rendered as its normal size rather then just    
// the size that is displayed.   
// Note: In order to preserve aspect ratio, set DecodePixelWidth   
// or DecodePixelHeight but not both.   
myBitmapImage.DecodePixelWidth = 2048;   
myBitmapImage.EndInit();   
//set image source   


Image img = new Image(); 
img.Source = myBitmapImage;

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-23
  • 2022-01-25
  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-26
  • 2021-06-27
  • 2022-12-23
相关资源
相似解决方案