以编程方式更改屏幕分辨率
-
03-07-2019 - |
题
有没有办法在Windows XP中以编程方式更改屏幕分辨率或启用/禁用多个显示器?例如,在两台显示器上从一台显示器的1024x768更改为1280x104?我会对win32函数最感兴趣,但是任何可以绑定到Windows快捷方式的东西就足够了。
解决方案
您可以使用 EnumDisplayDevices 来确定您拥有的显示内容并 EnumDisplaySettings 获取显示器的可用分辨率列表。使用 ChangeDisplaySettings 来设置所需的分辨率。
其他提示
您可以使用 http://www.autohotkey.com 轻松编写此脚本
这是一个用Windows + 1和Windows + 2在一台显示器和两台显示器之间交换的脚本
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Recommended for catching common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#1::
Send {LWin}
WinWaitActive Start menu
Send Adjust Screen Resolution
Send {enter}
WinWaitActive Screen Resolution
ControlClick ComboBox3
Send {PgDn}
Send {Up} ; Select "Show desktop only on 1"
Send {enter}
Sleep 3000 ; workaround - cannot select accept/revert window?
Send {left}
Send {enter} ; accept changes
Return
#2::
Send {LWin}
WinWaitActive Start menu
Send Adjust Screen Resolution
Send {enter}
WinWaitActive Screen Resolution
ControlClick ComboBox3
Send {PgDn}
Send {Up}
Send {Up} ; Select "Extend these displays"
Send {enter}
Sleep 3000 ; workaround - cannot select accept/revert window?
Send {left}
Send {enter} ; accept changes
Return
轻松阅读给定的链接。
只需下载dll就可以了..
Screen Srn=Screen.PrimaryScreen;
int tempWidth=Srn.Bounds.Width;
int tempHeight=Srn.Bounds.Height;
Console.WriteLine("Current Screen width is {0} and height is {1}.",
tempWidth,
tempHeight);
不隶属于 StackOverflow