Aracılığıyla paylaş


DisplayInformation Class

Definition

Monitors and controls display-related information for an application view. The class provides events to allow clients to monitor for changes in the application view affecting which display(s) the view resides on, as well as changes in displays that can affect the application view.

public ref class DisplayInformation sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class DisplayInformation final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class DisplayInformation
Public NotInheritable Class DisplayInformation
Inheritance
Object Platform::Object IInspectable DisplayInformation
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

A DisplayInformation instance does not map to a specific display, but instead tracks display-related information for wherever the application view is placed. Calling GetForCurrentView will always return the single instance for the current thread's CoreApplicationView. An instance of DisplayInformation can only be used from the thread on which it was created.

To handle DisplayInformation events, use an event handler for the specific event. For example, for DisplayInformation.DpiChanged, use "TypedEventHandler<DisplayInformation, Object> DpiChanged."

Any property change event of DisplayInformation might trigger if your app is moved from one monitor to another monitor. ColorProfileChanged is triggered when the display’s color profile changes. DpiChanged is triggered when the LogicalDpi, ResolutionScale, and RawPixelsPerViewPixel properties change because a user selected a different zoom level or changed the screen resolution. OrientationChanged is triggered if a user changes the screen orientation.

Version history

Windows version SDK version Value added
1511 10586 DiagonalSizeInInches
1607 14393 ScreenHeightInRawPixels
1607 14393 ScreenWidthInRawPixels
1803 17134 AdvancedColorInfoChanged
1803 17134 GetAdvancedColorInfo

Properties

AutoRotationPreferences

Gets and sets the preferred orientation of the app.

CurrentOrientation

Gets the current orientation of a rectangular monitor.

DiagonalSizeInInches

Diagonal size of the display in inches.

LogicalDpi

Gets the pixels per logical inch of the current environment.

NativeOrientation

Gets the native orientation of the display monitor, which is typically the orientation where the buttons on the device match the orientation of the monitor.

RawDpiX

Gets the raw dots per inch (DPI) along the x axis of the display monitor.

RawDpiY

Gets the raw dots per inch (DPI) along the y axis of the display monitor.

RawPixelsPerViewPixel

Gets a value representing the number of raw (physical) pixels for each view (layout) pixel.

ResolutionScale

Gets the scale factor of the app window.

ScreenHeightInRawPixels

Returns the current height resolution of the logical monitor.

ScreenWidthInRawPixels

Returns the current width resolution of the logical monitor.

StereoEnabled

Gets a value that indicates whether the device supports stereoscopic 3D.

Methods

GetAdvancedColorInfo()

Retrieves the Advanced Color information.

GetColorProfileAsync()

Asynchronously gets the default International Color Consortium (ICC) color profile that is associated with the physical display.

GetForCurrentView()

Gets the DisplayInformation instance associated with the current thread's CoreApplicationView. This DisplayInformation instance is tied to the view and cannot be used from other threads.

Events

AdvancedColorInfoChanged

Raised when the advanced color information is changed.

ColorProfileChanged

Occurs when the physical display's color profile changes.

DisplayContentsInvalidated

Occurs when the display requires redrawing.

DpiChanged

Occurs when the LogicalDpi property changes because the pixels per inch (PPI) of the display changes.

OrientationChanged

Occurs when either the CurrentOrientation or NativeOrientation property changes because of a mode change or a monitor change.

StereoEnabledChanged

Occurs when the StereoEnabled property changes because support for stereoscopic 3D changes.

Applies to

See also