我如何获得屏幕方向? [英] How I can get screen orientation?

查看:48
本文介绍了我如何获得屏幕方向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在输入要在其上显示表单的屏幕编号.我必须获得屏幕方向.有人知道怎么做吗?

I'm entering number of screen on which I want to show the form. And I must get screen orientation. Does anybody know how to do that?

 public UIManager(int screenIndex)
    {
        this.ScreenIndex = screenIndex;            

        try
        {
            Screen[] all_screens;
            all_screens = Screen.AllScreens;

            if (all_screens.Length >= ScreenIndex)
            {
                this.customer_form.Left = all_screens[this.ScreenIndex].Bounds.Width;
                this.customer_form.Top = all_screens[this.ScreenIndex].Bounds.Height;                    
                this.customer_form.Show();
            }
        }
        catch
        {
            //Do nothing
        }
    }

推荐答案

您可以使用 Windows.Graphics.Display.DisplayInformation class,由 DisplayInformation.getForCurrentView() 及其 currentOrientation 返回> 属性:>

You can use the value from the Windows.Graphics.Display.DisplayInformation class, returned by DisplayInformation.getForCurrentView() and its currentOrientation property:

 DisplayOrientations currentOrientation = Windows.Graphics.Display.DisplayProperties.CurrentOrientation;

来自官方文档:

这篇关于我如何获得屏幕方向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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