我想自己调整屏幕亮度.因为 Windows 让我只能在有限的范围内进行调整.我想将显示器从 0 调暗到 100% 并将其关闭/打开.如果Windows可以自动执行它应该是可能的(在:x分钟后显示暗淡/在:x分钟后关闭显示).我尝试了一些我通过谷歌找到的资源和类.但它们都不起作用.
I want ajust screen brightness by my self. Because Windows lets me only adjusting in limited range. I want dim the display from 0 to 100% and turning it off/on. It should be possible if windows can it do automatically (Dim display after: x minutes/Turn off display after: x minutes). I tried some sources and classes what I found by google. But no of them works.
你有没有试过这个,或者你能推荐我任何工作代码吗?
Have you ever tried this or can you recommend me any working code?
感谢您的回复.
您可以使用 WmiSetBrightness 方法:
using System.Management;
//...
static void SetBrightness(byte targetBrightness) {
ManagementScope scope = new ManagementScope("root\WMI");
SelectQuery query = new SelectQuery("WmiMonitorBrightnessMethods");
using(ManagementObjectSearcher searcher = new ManagementObjectSearcher(scope, query)) {
using(ManagementObjectCollection objectCollection = searcher.Get()) {
foreach(ManagementObject mObj in objectCollection) {
mObj.InvokeMethod("WmiSetBrightness",
new Object[] { UInt32.MaxValue, targetBrightness });
break;
}
}
}
}
有关详细信息,请查看 WDDM 中的亮度控制 和 监控配置功能
For more details, please take a look at Brightness Control in WDDM and Monitor Configuration Functions
这篇关于C# 设置屏幕亮度 Windows 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!