Table of Contents

Class ScreenExtensions

Namespace
VisioForge.Core.UI
Assembly
VisioForge.Core.dll

Provides extension methods for working with screen displays and DPI awareness.

public static class ScreenExtensions

Inheritance

Inherited Members

Remarks

This class contains helper methods for retrieving display-specific information, particularly DPI (dots per inch) settings for multi-monitor configurations. These extensions are essential for proper scaling in high-DPI environments.

Methods

GetDpi(Screen, DpiType, out uint, out uint)

Gets the DPI (dots per inch) settings for the specified screen.

public static void GetDpi(this Screen screen, DpiType dpiType, out uint dpiX, out uint dpiY)

Parameters

screen Screen

The screen to query for DPI information.

dpiType DpiType

The type of DPI to retrieve (effective, angular, or raw).

dpiX uint

When this method returns, contains the horizontal DPI value.

dpiY uint

When this method returns, contains the vertical DPI value.

Examples

var screen = Screen.PrimaryScreen;
uint dpiX, dpiY;
screen.GetDpi(DpiType.Effective, out dpiX, out dpiY);
Console.WriteLine($"Screen DPI: {dpiX}x{dpiY}");

Remarks

This method retrieves per-monitor DPI settings on Windows 8.1 and later. On earlier versions of Windows, it returns the standard 96 DPI value. Per-monitor DPI awareness is crucial for applications that span multiple displays with different DPI settings.