Windows runtime 获取物理屏幕(显示)分辨率。Windows应用商店应用程序

Windows runtime 获取物理屏幕(显示)分辨率。Windows应用商店应用程序,windows-runtime,windows-8.1,windows-10,Windows Runtime,Windows 8.1,Windows 10,我需要当前的显示分辨率。我怎么能得到这个?我知道Window.Current.Bounds,但应用程序可以在windows模式下工作。什么意思是VisibleBunds不能在Deskptop上工作? 我在我的win10 UWP程序中尝试过,效果很好。我可以获得如下的桌面分辨率: var bounds = ApplicationView.GetForCurrentView().VisibleBounds; var scaleFactor = DisplayInformation.GetFo

我需要当前的显示分辨率。我怎么能得到这个?我知道
Window.Current.Bounds
,但应用程序可以在windows模式下工作。

什么意思是VisibleBunds不能在Deskptop上工作? 我在我的win10 UWP程序中尝试过,效果很好。我可以获得如下的桌面分辨率:

  var bounds = ApplicationView.GetForCurrentView().VisibleBounds;
  var scaleFactor = DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;
  var size = new Size(bounds.Width * scaleFactor, bounds.Height * scaleFactor);
此外,如果您正在使用DX in-store应用程序,则可以创建IDXGIFactory对象并使用它枚举可用的适配器。然后调用IDXGIOutput::GetDisplayModeList来检索DXGI_MODE_DESC结构的数组和数组中的元素数。每个DXGI_MODE_DESC结构表示输出的有效显示模式。e、 g:

   UINT numModes = 0;
   DXGI_MODE_DESC* displayModes = NULL;
   DXGI_FORMAT format = DXGI_FORMAT_R32G32B32A32_FLOAT;

    // Get the number of elements
    hr = pOutput->GetDisplayModeList( format, 0, &numModes, NULL);

    displayModes = new DXGI_MODE_DESC[numModes]; 

    // Get the list
    hr = pOutput->GetDisplayModeList( format, 0, &numModes, displayModes);

如果您需要更多信息,请告诉我。

感谢您的回答,可能是重复的,但此解决方案适用于Windows Phone(Mobile)。在windows桌面中,VisibleBounds不可用。如下所示: