我有一个处于纵向模式的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
发布评论