DisplayProperties Class
提供与实际显示相关的各种属性。 对于其中的大多数属性,类会提供事件以允许客户端监视属性中的变更。
语法
特性
- MarshalingBehaviorAttribute(Agile)
- StaticAttribute(Windows.Graphics.Display.IDisplayPropertiesStatics, NTDDI_WIN8)
- VersionAttribute(NTDDI_WIN8)
成员
DisplayProperties类 具有以下类型的成员:
事件
DisplayProperties类 具有以下事件。
| 事件 | 描述 |
|---|---|
| ColorProfileChanged | Occurs when the physical display's color profile changes. |
| DisplayContentsInvalidated | Occurs when the display requires redrawing. |
| LogicalDpiChanged | 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. |
方法
The DisplayProperties 类 具有以下方法。 使用 C#、Visual Basic 和 C++,它还可以继承以下内容中的方法 Object 类.
| 方法 | 描述 |
|---|---|
| GetColorProfileAsync | Asynchronously gets the default International Color Consortium (ICC) color profile that is associated with the physical display. |
属性
该 DisplayProperties类 具有以下属性。
| 属性 | 访问类型 | 描述 |
|---|---|---|
| 读取/写入 | Gets and sets the preferred orientation of the app. | |
| 只读 | Gets the current orientation of a rectangular monitor. | |
| 只读 | Gets the pixels per logical inch of the current environment. | |
| 只读 | 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. | |
| 只读 | Gets the scale factor of the immersive environment. | |
| 只读 | Gets a value that indicates whether the device supports stereoscopic 3D. |
备注
建议应用程序使用一个委托来处理大多数事件,因为在许多情况下对于每个显示特性的更改要求应用程序重绘自身。此外,许多属性更改源自影响整个操作系统的单个模式更改。所有事件都共享以下委托类型。
[version(NTDDI_WIN8), object, uuid(dbdd8b01-f1a1-46d1-9ee3-543bcc995980)]
delegate HRESULT DisplayPropertiesEventHandler([in] IInspectable *sender);
然后,应用程序可以实现单独的处理程序,并为每个属性更改事件注册该处理程序。
如果您的应用程序从一个显示器移到另一个显示器,则可能触发 DisplayProperties 的任何属性更改事件。仅当将应用程序移动到了另一个监视器,且该监视器具有不同的颜色配置文件时,才触发 ColorProfileChanged。LogicalDpiChanged 在 LogicalDpi 或 ResolutionScale 属性因为用户选择不同的缩放级别或更改了屏幕分辨率时触发。如果用户更改屏幕方向,则 OrientationChanged 被触发。
要求
|
最低受支持的客户端 | Windows 8 [仅 Windows 应用商店应用] |
|---|---|
|
最低受支持的服务器 | Windows Server 2012 [仅 Windows 应用商店应用] |
|
最低受支持的电话 | Windows Phone 8 |
|
命名空间 |
|
|
元数据 |
|