带有双显示器的 Windows 屏幕边界 [英] Windows screen bounds with dual monitors
问题描述
我希望在 powershell 中使用双显示器获得总屏幕分辨率.
I am looking to get the total screen resolution using dual monitors in powershell.
$screen = [System.Windows.Forms.Screen]::PrimaryScreen
$SCREENWIDTH = [int]$screen.bounds.Size.Width
$SCREENHEIGHT = [int]$screen.bounds.Size.Height
有了这个,我得到了 1920 X 1200,但分辨率实际上是 3840 X 1200.我可以将分辨率提高一倍,但是根据所使用的显示器,这并不总是有效.
With this I get 1920 X 1200 but the resolution is actually 3840 X 1200. I could just double the resolution, however that wont always work depending on the monitors being used.
我在 powershell studio 中执行此操作.知道这一点的原因是因为有时程序会在屏幕外打开,如果它确实在屏幕外打开,我可以将其移回右下角.
I am doing this within powershell studio. The reason for knowing this is because sometimes the program opens up off screen, if it does open off screen, I can move it back to the bottom right hand corner.
推荐答案
在主屏幕上,分辨率仍然是 1920x1200.您可以检查附加了多少屏幕( [System.Windows.Forms.Screen]::AllScreens
)并使用边界 [System.Windows.Forms.Screen]::AllScreens|选择 -ExpandProperty bounds
.
On the primary Screen the Resolution is still 1920x1200. You can check, how much screens are attached ( [System.Windows.Forms.Screen]::AllScreens
) and work with the bounds [System.Windows.Forms.Screen]::AllScreens | select -ExpandProperty bounds
.
这篇关于带有双显示器的 Windows 屏幕边界的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!