I would like to get the screen resolution (only one monitor support is fine).
I would rather avoid referencing either WinForms or WPF dlls, as outlined in all answers here, since I am in a non-UI dll. (Yes, I know it would be possible.)
Is there some way to get the resolution without those dependencies?
Actually, I would like to use this to capture screen shots in a UI testing .dll - all code samples I have found rely on knowing the screen bounds, the shortest one is:
System.Drawing.Rectangle bounds = Screen.GetBounds(Point.Empty);
using (Bitmap bitmap = new Bitmap(bounds.Width, bounds.Height))
{
using (Graphics g = Graphics.FromImage(bitmap))
{
g.CopyFromScreen(System.Drawing.Point.Empty, System.Drawing.Point.Empty, bounds.Size);
}
bitmap.Save("test.jpg", ImageFormat.Jpeg);
}