How do you get the screen size in a console application?
var w = Console.WindowWidth;
var h = Console.WindowHeight;
--EDIT--
Screen.PrimaryScreen.Bounds
Screen.PrimaryScreen.WorkingArea
If you want get display size you can use WMI(Windows Management Instrumentation)
var scope = new ManagementScope();
scope.Connect();
var query = new ObjectQuery("SELECT * FROM Win32_VideoController");
using (var searcher = new ManagementObjectSearcher(scope, query))
{
var results = searcher.Get();
foreach (var result in results)
{
Console.WriteLine("Horizontal resolution: " + result.GetPropertyValue("CurrentHorizontalResolution"));
Console.WriteLine("Vertical resolution: " + result.GetPropertyValue("CurrentVerticalResolution"));
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With