using System.Drawing;
using System.Runtime.InteropServices;
namespace Photino.NET
{
///
/// Represents a 2D rectangle in a native (integer-based) coordinate system.
///
[StructLayout(LayoutKind.Sequential)]
public struct NativeRect
{
public int x, y;
public int width, height;
}
///
/// The NativeMonitor structure is used for communicating information about the monitor setup
/// to and from native system calls. This structure is defined in a sequential layout for direct,
/// unmanaged access to the underlying memory.
///
[StructLayout(LayoutKind.Sequential)]
public struct NativeMonitor
{
public NativeRect monitor;
public NativeRect work;
public double scale;
}
///
/// Represents information about a monitor.
///
public readonly struct Monitor
{
///
/// The full area of the monitor.
///
public readonly Rectangle MonitorArea;
///
/// The working area of the monitor excluding taskbars, docked windows, and docked tool bars.
///
public readonly Rectangle WorkArea;
///
/// The scale factor of the monitor. Standard value is 1.0.
///
public readonly double Scale;
///
/// Initializes a new instance of the struct.
///
/// The area of monitor.
/// The working area of the monitor.
public Monitor(Rectangle monitor, Rectangle work, double scale)
{
MonitorArea = monitor;
WorkArea = work;
Scale = scale;
}
///
/// Initializes a new instance of the struct using native structures.
///
/// The area of monitor as
/// The working area as
internal Monitor(NativeRect monitor, NativeRect work, double scale)
: this(new Rectangle(monitor.x, monitor.y, monitor.width, monitor.height), new Rectangle(work.x, work.y, work.width, work.height), scale)
{ }
///
/// Initializes a new instance of the struct using a native monitor structure.
///
/// The native monitor structure.
internal Monitor(NativeMonitor nativeMonitor)
: this(nativeMonitor.monitor, nativeMonitor.work, nativeMonitor.scale)
{ }
}
}