【问题标题】:How to get the actual desktop screen resolution in wpf? [duplicate]如何在 wpf 中获得实际的桌面屏幕分辨率? [复制]
【发布时间】:2016-07-11 22:08:38
【问题描述】:

我正在使用 WPF 开发一个 kinect 应用程序。现在我需要获得实际的桌面屏幕分辨率,以便我可以缩放该区域以便为任何笔记本电脑截屏。我已经尝试过 PrimaryScreenWidth、PrimaryScreenHeight、FullScreenHeight 等等,但它们都没有给我实际的分辨率。例如,如果我有 1920*1080,上面的那些字段会给我一些其他的值。

我想知道如何从 C# WPF 中获取实际的桌面屏幕分辨率?

【问题讨论】:

    标签: c# wpf screenshot screen-resolution


    【解决方案1】:

    就用这个吧:

    System.Windows.SystemParameters.PrimaryScreenWidth
    System.Windows.SystemParameters.PrimaryScreenHeight
    

    或者这个:

    System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width
    System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height
    

    【讨论】:

    • 这会返回与实际分辨率无关的屏幕尺寸。
    猜你喜欢
    • 2012-01-31
    • 2011-11-10
    • 2011-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-05
    • 2018-10-31
    相关资源
    最近更新 更多