从当前方向旋转Web浏览器正在拉伸(缩放)Web浏览器内容Windows Phone

编程入门 行业动态 更新时间:2024-10-28 22:23:13
本文介绍了从当前方向旋转Web浏览器正在拉伸(缩放)Web浏览器内容Windows Phone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个处于纵向模式的Web浏览器.我正在使用

I have a webbrowser which is in portrait mode. I am loading the webbrowser using

this.webBrowserControl.Source = new Uri("google");

加载内容后,视图如下所示:

When the content is loaded the view looks like this

提供了旋转按钮,因此,如果用户处于纵向模式并且用户按了旋转按钮,那么我将使用transform旋转webview并设置其高度和宽度,以使其可以占据整个屏幕

there is rotate button provided, so if user is in portrait mode and user presses rotate button then I am rotating the webview using transform and setting its height and width so that it can occupy the whole screen

pageWidth = 480; pageHeight = 800; RotateTransform transform = new RotateTransform(); transform.Angle = 90; this.webbrowser.RenderTransform = transform; webbrowser.Width = pageHeight; webbrowser.Height = pageWidth;

网络浏览器已旋转,但是内容看起来像是缩放或拉伸,它可以这个

The webbrowser is rotated but the contents looks like zoomed or stretched, it looks like this

任何想法如何不缩放内容?

Any idea how not to zoom the content??

推荐答案

更改缩放百分比:

// figure out the ratio you want to reduce by string zoom_js = "document.body.style.zoom=\"50%\";"; try { this.myBrowser.IsScriptEnabled = true; this.myBrowser.InvokeScript("eval", zoom_js); } catch(Exception ex) { }

它没有缩放任何东西.只是旋转它然后拉伸(调整大小)容器即可.

It is not zooming anything. It just that you are rotating it then stretching (resizing) the container.

鉴于分辨率,如果您不希望进行任何拉伸,则必须保持宽高比.

Given your resolution, you have to have keep the aspect ratio if you don't want any stretching to be done.

<phone:WebBrowser x:Name="myBrowser" RenderTransformOrigin="0.5,0.5" Height="480" Width="480" Margin="0" Padding="0"> <phone:WebBrowser.RenderTransform> <CompositeTransform Rotation="90"/> </phone:WebBrowser.RenderTransform> </phone:WebBrowser> </Border>

现在不会拉伸,但也不会覆盖整个屏幕.现在,想象一下像您一样拉伸容器.结果将是您发布的图像.

Now that won't be stretched but it also not cover the entire screen. Now, imagine stretching the container like you did. The result will be your image you posted.

更多推荐

从当前方向旋转Web浏览器正在拉伸(缩放)Web浏览器内容Windows Phone

本文发布于:2023-11-09 16:17:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1572837.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:浏览器   缩放   方向   内容   Phone

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!