DisplayInformation 類別

定義

監視和控制項應用程式檢視的顯示相關資訊。 類別提供事件,可讓用戶端監視應用程式檢視中的變更,影響檢視所在的顯示 () ,以及可能會影響應用程式檢視的顯示變更。

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
繼承
Object Platform::Object IInspectable DisplayInformation
屬性

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)

備註

DisplayInformation 實例不會對應至特定顯示,而是會追蹤應用程式檢視放置位置的顯示相關資訊。 呼叫 GetForCurrentView 一律會傳回目前線程 CoreApplicationView的單一實例。 DisplayInformation 的實例只能從建立所在的執行緒使用。

若要處理 DisplayInformation 事件,請使用特定事件的事件處理常式。 例如,針對 DisplayInformation.DpiChanged,請使用 「TypedEventHandler < DisplayInformation, Object > DpiChanged」。

如果您的 app 從一部監視器移至另一部監視器,則 DisplayInformation 的任何屬性變更事件可能會觸發。 當顯示器的色彩設定檔變更時,會觸發 ColorProfileChanged。 當LogicalDpiResolutionScaleRawPixelsPerViewPixel屬性變更時,會觸發 DpiChanged,因為使用者選取了不同的縮放層級或變更螢幕解析度。 如果使用者變更螢幕方向,會觸發 OrientationChanged

版本歷程記錄

Windows 版本 SDK 版本 已新增值
1511 10586 對角線SizeInInches
1607 14393 ScreenHeightInRawPixels
1607 14393 ScreenWidthInRawPixels
1803 17134 AdvancedColorInfoChanged
1803 17134 GetAdvancedColorInfo

屬性

AutoRotationPreferences

取得並設定應用程式的慣用方向。

CurrentOrientation

取得矩形監視器的目前方向。

DiagonalSizeInInches

以英吋為單位的對角線顯示大小。

LogicalDpi

取得目前環境每個邏輯英吋的圖元。

NativeOrientation

取得顯示監視器的原生方向,通常是裝置上的按鈕符合監視器方向的方向。

RawDpiX

取得每英吋的原始點, (DPI) 沿著顯示器監視器的 X 軸。

RawDpiY

取得沿著顯示器監視器的 Y 軸 (DPI) 的原始點。

RawPixelsPerViewPixel

取得值,表示每個檢視 (版面配置) 圖元的原始 (實體) 圖元數目。

ResolutionScale

取得應用程式視窗的縮放比例。

ScreenHeightInRawPixels

傳回邏輯監視器目前的高度解析度。

ScreenWidthInRawPixels

傳回邏輯監視器目前的寬度解析度。

StereoEnabled

取得值,這個值表示裝置是否支援立體立體 3D。

方法

GetAdvancedColorInfo()

擷取進階色彩資訊。

GetColorProfileAsync()

以非同步方式取得與實體顯示器相關聯的預設國際色彩聯盟 (ICC) 色彩設定檔。

GetForCurrentView()

取得與目前線程 CoreApplicationView相關聯的 DisplayInformation 實例。 此 DisplayInformation 實例系結至檢視,無法從其他執行緒使用。

事件

AdvancedColorInfoChanged

變更進階色彩資訊時引發。

ColorProfileChanged

發生于實體顯示器的色彩設定檔變更時。

DisplayContentsInvalidated

發生于顯示需要重新繪製時。

DpiChanged

發生于 LogicalDpi 屬性變更時,因為每英吋的圖元 () 顯示變更。

OrientationChanged

發生于因為模式變更或監視變更而變更 CurrentOrientationNativeOrientation 屬性時。

StereoEnabledChanged

StereoEnabled 屬性變更時發生,因為支援立體 3D 變更。

適用於

另請參閱