【问题标题】:RotateTransform Webview in Windows 8 Metro appsWindows 8 Metro 应用程序中的 RotateTransform Webview
【发布时间】:2012-08-28 12:59:42
【问题描述】:

我在使用 RotateTransform 单击按钮时在 Windows 8 Metro Apps 中旋转 Webview 控件时遇到问题。

RotateTransform rt = new RotateTransform();
        rt.CenterX = webView.Width / 2;
        rt.CenterY = webView.Height / 2;
        rt.Angle = 90;
        webView.RenderTransform = rt;

如您所见,我正在将 Webview 旋转 90 度,但 Webview 没有旋转。

请参考: http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/d25bb7bd-d7ac-4e15-a4ee-882bf21464da

有什么帮助/解决方案/理由对我有帮助吗?

【问题讨论】:

    标签: c# microsoft-metro visual-studio-2012


    【解决方案1】:

    WebView 是特殊的,不能在 XAML 应用程序中旋转。这是因为 WebView 是 Internet Explorer 的一个实例,它是一个 ActiveX 组件(可能仍以这种方式托管),不能以与 XAML 内容相同的方式旋转。 WebViews 总是与设备的旋转对齐。对于它的价值,WPF 有类似的设计限制。

    根据您要完成的任务,基于 HTML 的 Win8 应用程序可能是更好的选择,因为您可以使用 CSS3 转换来旋转 HTML 内容。或者,您可以在 XAML 应用程序中旋转浏览器内部的内容,只要您不需要直角(0、90、180、270)以外的任何内容。

    【讨论】:

      【解决方案2】:

      从 Windows 8.1 开始,WebView 应该能够旋转。

      <WebView x:Name="WebView1" RenderTransformOrigin="0.5,0.5">
      <WebView.RenderTransform>
          <CompositeTransform Rotation="30" ScaleX="1" ScaleY="1" SkewX="15" SkewY="0" />
      </WebView.RenderTransform>
      

      见:What’s new in WebView in Windows 8.1

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-04-03
        • 1970-01-01
        • 2012-06-29
        • 2013-08-08
        • 1970-01-01
        相关资源
        最近更新 更多