-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathScreenSize.cs
More file actions
29 lines (26 loc) · 1.09 KB
/
ScreenSize.cs
File metadata and controls
29 lines (26 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// This file is part of the SimWinMouse project, which is released under MIT License.
// For details, see: https://github.com/DavidRieman/SimWinInput
namespace SimWinInput
{
using System;
/// <summary>Methods for gathering screen size information.</summary>
public class ScreenSize
{
/// <summary>Gets the width of the physical screen.</summary>
static public int Width()
{
IntPtr globalDeviceContext = InteropScreen.GetDC(IntPtr.Zero);
int i = InteropScreen.GetDeviceCaps(globalDeviceContext, (int)InteropScreen.DeviceCaps.HORZSIZE);
InteropScreen.ReleaseDC(IntPtr.Zero, globalDeviceContext);
return i;
}
/// <summary>Gets the height of the physical screen.</summary>
static public int Height()
{
IntPtr globalDeviceContext = InteropScreen.GetDC(IntPtr.Zero);
int i = InteropScreen.GetDeviceCaps(globalDeviceContext, (int)InteropScreen.DeviceCaps.VERTSIZE);
InteropScreen.ReleaseDC(IntPtr.Zero, globalDeviceContext);
return i;
}
}
}