开发者

read local image in wp7

开发者 https://www.devze.com 2023-04-12 07:02 出处:网络
In my app i need to open a local image for cropping. I tried this by setting 开发者_Go百科the path of the image as source to a BitmapImage but it raising an error. How i can read and assign that local

In my app i need to open a local image for cropping. I tried this by setting 开发者_Go百科the path of the image as source to a BitmapImage but it raising an error. How i can read and assign that local image to BitmapImage in WP Mango.


   private WriteableBitmap ReadLocalImage(string Uri)
        {
            StreamResourceInfo sri = null;
            Uri uri = new Uri(Uri, UriKind.Relative);
            sri = Application.GetResourceStream(uri);
            BitmapImage bitmap = new BitmapImage();
            bitmap.CreateOptions = BitmapCreateOptions.None;
            bitmap.SetSource(sri.Stream);
            WriteableBitmap wb = new WriteableBitmap(bitmap);
            return wb;

        }

use this method for reading local image.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号