簡體   English   中英

使彈出窗口以橫向模式顯示

[英]Make popup appear in landscape mode

HEJ

我有一個需要在橫向模式下運行的應用程序。 問題是當我使用LiveId登錄時,我必須將方向設置為Portrait,因為liveid僅支持縱向模式。

我的問題是,即使系統處於縱向模式,我也想以橫向模式顯示彈出窗口。

我嘗試了旋轉,並在旋轉發生時做了一些代碼:

 private void PhoneApplicationPage_OrientationChanged(object sender, OrientationChangedEventArgs e)
    {
        // Switch the placement of the buttons based on an orientation change.
        if ((e.Orientation & PageOrientation.Portrait) == (PageOrientation.Portrait))
        {

        }
        // If not in portrait, move buttonList content to visible row and column.
        else
        {
        }
    } 

但是沒有成功。 任何人都知道如何在橫向模式下顯示彈出窗口,即使方向發生變化也是如此。

我希望有人能提供幫助,因為幾天后,我仍然無法解決問題。

您只需要使用“合成變換”,以及圍繞中心,旋轉和平移的播放。 但是,您必須使用我上面輸入的代碼段。 因為您將需要為landscapeLeft和LandscapeRight編寫代碼

if ((e.Orientation & PageOrientation.LandscapeLeft) == PageOrientation.LandscapeLeft)
        {
            rotate = false;
        }
        else if ((e.Orientation & PageOrientation.LandscapeRight) == PageOrientation.LandscapeRight)
        {
            rotate = true;
        }
        if ((e.Orientation & PageOrientation.Portrait) == (PageOrientation.Portrait))
        {
            if (!rotate) { 
                CompositeTransform Trans = new CompositeTransform();
                Trans.Rotation = 90;

                Trans.TranslateY=-200;
                Trans.TranslateX = -120;

                Trans.CenterY = 400;
                Trans.CenterX = 200;
                popup.RenderTransform = Trans;
            }
            else
            {
                CompositeTransform Trans = new CompositeTransform();
                Trans.Rotation = -90;

                Trans.TranslateY = 200;
                Trans.TranslateX = 200;
                Trans.CenterY = 400;
                Trans.CenterX = 200;
                popup.RenderTransform = Trans;
            }
            /*RotateTransform myRotateTransform = new RotateTransform();
            if (rotate)
            {
                myRotateTransform.Angle = 90;
                myRotateTransform.CenterY = popup.ActualHeight / 2;
                myRotateTransform.CenterX = popup.ActualWidth / 2;

                popup.RenderTransform = myRotateTransform;
            }*/

        }
        // If not in portrait, move buttonList content to visible row and column.
        else
        {
        }
  }

那就是我最終所要解決的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM