Class DisplayInfo
- Namespace
- VisioForge.Core.Types
- Assembly
- VisioForge.Core.dll
Represents detailed information about a display device, including its resolution, working area, and DPI settings.
public class DisplayInfoInheritance
Inherited Members
Remarks
This class is used to enumerate and query the properties of connected display monitors. It provides essential information for screen capture and video rendering applications that need to adapt to different screen sizes and resolutions.
The information in this class is particularly useful for:
- Multi-monitor applications that need to position windows on specific displays
- Screen capture software that needs to know the exact bounds of each monitor
- DPI-aware applications that need to scale UI elements appropriately
- Video playback applications that need to adapt to different screen resolutions
Properties
Bounds
Gets or sets the absolute screen coordinates of the display, including non-client areas.
public Rectangle Bounds { get; set; }Property Value
Remarks
The bounds represent the complete area of the display, including any system UI elements such as taskbars, docks, or menu bars. For multi-monitor setups, these coordinates are in the virtual desktop coordinate space.
For example, a secondary monitor positioned to the right of a 1920x1080 primary monitor might have bounds of (1920, 0, 1920, 1080), indicating it starts at X=1920.
DeviceId
Gets or sets the unique identifier for the display device.
public string DeviceId { get; set; }Property Value
Remarks
The device ID is a system-specific identifier that remains consistent across application restarts and can be used to save and restore window positions on specific monitors.
On Windows, this might be a device path like "\\.\DISPLAY1". On other platforms, the format may vary but will remain unique and persistent for each connected display.
DpiX
Gets or sets the horizontal dots per inch (DPI) of the display.
public uint DpiX { get; set; }Property Value
Remarks
The DPI value indicates the pixel density of the display in the horizontal direction. Standard displays typically have 96 DPI, while high-DPI (HiDPI/Retina) displays may have 144, 192, or higher DPI values.
To calculate the scaling factor for UI elements, divide this value by 96:
float scaleX = DpiX / 96.0f;
DpiY
Gets or sets the vertical dots per inch (DPI) of the display.
public uint DpiY { get; set; }Property Value
Remarks
The DPI value indicates the pixel density of the display in the vertical direction. In most cases, this will be the same as VisioForge.Core.Types.DisplayInfo.DpiX, but some displays may have non-square pixels resulting in different horizontal and vertical DPI values.
To calculate the scaling factor for UI elements, divide this value by 96:
float scaleY = DpiY / 96.0f;
FullName
Gets or sets the full name of the display device, as reported by the system.
public string FullName { get; set; }Property Value
Remarks
This typically includes the manufacturer and model of the display, such as "Dell U2415" or "Generic PnP Monitor". The exact format depends on the display driver and how the monitor identifies itself to the operating system.
This name is suitable for displaying to users in UI elements when they need to select or identify a specific monitor.
WorkingArea
Gets or sets the working area of the display, which excludes taskbars, docked windows, and docked toolbars.
public Rectangle WorkingArea { get; set; }Property Value
Remarks
The working area is the portion of the screen available for application windows. It excludes areas reserved by the system, such as the Windows taskbar, macOS dock, or Linux panels.
Applications should use this area when maximizing windows or calculating available space for content to ensure they don't overlap with system UI elements.