public Size GetMaximumScreenSizePrimary()
{
var scope = new System.Management.ManagementScope();
var q = new System.Management.ObjectQuery("SELECT * FROM CIM_VideoControllerResolution");
UInt32 maxHResolution = 0;
UInt32 maxVResolution = 0;
using (var searcher = new System.Management.ManagementObjectSearcher(scope, q))
{
var results = searcher.Get();
foreach (var item in results)
{
if ((UInt32)item["HorizontalResolution"] > maxHResolution)
maxHResolution = (UInt32)item["HorizontalResolution"];
if ((UInt32)item["VerticalResolution"] > maxVResolution)
maxVResolution = (UInt32)item["VerticalResolution"];
}
}
return new Size(maxHResolution, maxVResolution);
}
{
var scope = new System.Management.ManagementScope();
var q = new System.Management.ObjectQuery("SELECT * FROM CIM_VideoControllerResolution");
UInt32 maxHResolution = 0;
UInt32 maxVResolution = 0;
using (var searcher = new System.Management.ManagementObjectSearcher(scope, q))
{
var results = searcher.Get();
foreach (var item in results)
{
if ((UInt32)item["HorizontalResolution"] > maxHResolution)
maxHResolution = (UInt32)item["HorizontalResolution"];
if ((UInt32)item["VerticalResolution"] > maxVResolution)
maxVResolution = (UInt32)item["VerticalResolution"];
}
}
return new Size(maxHResolution, maxVResolution);
}
No comments:
Post a Comment