旋转影像来源 [英] Rotating image source

查看:59
本文介绍了旋转影像来源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用相机拍摄了照片(设置为VideoBrush源),尽管将其设置为人像模式,但产品照片却是逆时针90度.我将img保存在iso存储器中,然后在另一个视图的Image对象中读取它.如何旋转 它??????

I took a photo with the camera (set to VideoBrush source) and despite the fact that it is set to Portrait mode the product photo is 90 degrees counter-clockwise. I save the img in the iso storage then read it in another view's Image object. How to rotate it?????

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            IDictionary<string, string> parameters = this.NavigationContext.QueryString;

            if (true == parameters.ContainsKey("ImgSrc"))
                src = parameters["ImgSrc"];

            try
            {
                BitmapImage BmpImg = new BitmapImage();
                
                using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication())
                {
                    using (IsolatedStorageFileStream fileStream = myIsolatedStorage.OpenFile(src, FileMode.Open, FileAccess.Read))
                    {
                        BmpImg.SetSource(fileStream);
                    }
                }

                Image1.Source = BmpImg;
            }
            catch { }
        }


推荐答案

您可以使用RotateTransform;

C#

You can use RotateTransform;

C#

RotateTransform rt = new RotateTransform();
            rt.Angle = 90;
            Image1.RenderTransform = rt;


VB.NET


VB.NET

Dim rt As New RotateTransform()
rt.Angle = 90
Image1.RenderTransform = rt


这篇关于旋转影像来源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆