如何使用c#中的WMI当前亮度属性获取屏幕亮度 [英] How can i get the Screen Brightness using the WMI Current brightness property in c#

查看:574
本文介绍了如何使用c#中的WMI当前亮度属性获取屏幕亮度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用'CurrentBrightness'属性值并设置值。但我发现API返回的值是错误的。

I am using the 'CurrentBrightness' property value for and a setting the value. but i see the value returned is wrong from the API.

有没有其他方法可以使用c#获取windows中的当前亮度值?

Is there any other way to get the exact current brightness value in windows using c#?

我怎么知道c#中是否检查了自适应亮度?

How can i know if the adaptive brightness is checked or not in c#?

感谢您的帮助.. !!

Thanks for the help..!!

此致,Ravi Raj Nukala

Regards, Ravi Raj Nukala

推荐答案

您好,

这是一个简单的示例,使用  ManagementScope作为参考。

Here is a simple sample which use ManagementScope for your reference.

//create a management scope object
ManagementScope scope = new ManagementScope("\\\\.\\ROOT\\WMI");

            //create object query
            ObjectQuery query = new ObjectQuery("SELECT * FROM WmiMonitorBrightness");

            //create object searcher
            ManagementObjectSearcher searcher =
                                    new ManagementObjectSearcher(scope, query);

            //get a collection of WMI objects
            ManagementObjectCollection queryCollection = searcher.Get();

            //enumerate the collection.
            foreach (ManagementObject m in queryCollection)
            {
                // access properties of the WMI object
                Console.WriteLine("CurrentBrightness : {0}", m["CurrentBrightness"]);

            }

祝你好运,

张龙


这篇关于如何使用c#中的WMI当前亮度属性获取屏幕亮度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆