我電腦接了2個顯示幕,設備管理中監視器下面也有2個,但按照如下2種方法只能顯示一個,why??????
還有什么方法,要將監視器下所有的顯示幕列出來~
ManagementObjectCollection moc2 = mc2.GetInstances();
foreach (ManagementObject mo2 in moc2)
{
//MessageBox.Show(moc2.Count.ToString());
//MessageBox.Show(mo2.Properties["Description"].Value.ToString());
r.AppendLine("顯示幕型別:: " + mo2.Properties["Description"].Value.ToString());
}
moc2 = null;
mc2 = null;
string query = "Select MonitorType from Win32_DesktopMonitor";
using (ManagementObjectSearcher searcher = new ManagementObjectSearcher(query))
{
foreach (ManagementObject mo in searcher.Get())
{
MessageBox.Show("顯示幕型別: " + mo["MonitorType"].ToString() + "\r\n顯示幕數量:" + searcher.Get().Count.ToString());
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/120816.html
標籤:一般軟件使用
