2013-02-11 2 views
0

Rad 컨트롤 (차트 및 gridview)을 사용하여 이미지를 컨트롤로 내보내는 데 필요한 응용 프로그램을 개발하고 있습니다. 각 컨트롤을 바이트로 변환하려고했습니다. 형식 및 webservice 보내고 이미지로 변환하지만 때로는 서비스에 바이트 데이터를 보내는 error.Is 다른 이미지로 각 컨트롤을 변환하는 다른 방법입니다. 나는 다른 방법을 시도했다.rad 컨트롤을 실버 라이트 이미지로 변환하는 방법

Stream fileStream = File.OpenRead(@"\\HARAVEER-PC\TempImages\FlashPivot.png"); 

     //PART 2 - use the stream to write the file output. 
     productChart.ExportToImage(fileStream, new Telerik.Windows.Media.Imaging.PngBitmapEncoder()); 
     fileStream.Close(); 

하는 것은 모든 사람에게 공유 권한을 준 TempImages.I 폴더에 액세스 할 수없는 것처럼 나에게 오류를 던지고 있지만 폴더에 액세스하지 않습니다.

모든 솔루션에 많은 감사드립니다.

답변

0
private BitmapImage CreateChartImages() 
    { 
     Guid photoID = System.Guid.NewGuid(); 
     string photolocation = @"D:\Temp\" + photoID.ToString() + ".jpg"; 


     BitmapImage bi = new BitmapImage(new Uri(photolocation, UriKind.Absolute)); 

     using (MemoryStream ms = new MemoryStream()) 
     { 
      radChart.ExportToImage(ms, new PngBitmapEncoder()); 
      bi.SetSource(ms); 
     } 
     return bi; 
    } 
관련 문제