DisplayPropertiesEventHandler 代理人
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
public delegate void DisplayPropertiesEventHandler(Platform::Object ^ sender);
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Deprecated("DisplayProperties may be altered or unavailable for releases after Windows Phone 8.1. Instead, use DisplayInformation.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.Guid(3688729345, 61857, 18129, 158, 227, 84, 59, 204, 153, 89, 128)]
class DisplayPropertiesEventHandler : MulticastDelegate
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.Guid(3688729345, 61857, 18129, 158, 227, 84, 59, 204, 153, 89, 128)]
/// [Windows.Foundation.Metadata.Deprecated("DisplayProperties may be altered or unavailable for releases after Windows Phone 8.1. Instead, use DisplayInformation.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
class DisplayPropertiesEventHandler : MulticastDelegate
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Deprecated("DisplayProperties may be altered or unavailable for releases after Windows Phone 8.1. Instead, use DisplayInformation.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.Guid(3688729345, 61857, 18129, 158, 227, 84, 59, 204, 153, 89, 128)]
public delegate void DisplayPropertiesEventHandler(object sender);
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.Guid(3688729345, 61857, 18129, 158, 227, 84, 59, 204, 153, 89, 128)]
[Windows.Foundation.Metadata.Deprecated("DisplayProperties may be altered or unavailable for releases after Windows Phone 8.1. Instead, use DisplayInformation.", Windows.Foundation.Metadata.DeprecationType.Deprecate, 65536, "Windows.Foundation.UniversalApiContract")]
public delegate void DisplayPropertiesEventHandler(object sender);
var displayPropertiesEventHandlerHandler = function(sender){
/* Your code */
}
Public Delegate Sub DisplayPropertiesEventHandler(sender As Object)
參數
- sender
-
Object
Platform::Object
IInspectable
引發事件的物件。
- 屬性
Windows 需求
裝置系列 |
Windows 10 (已於 10.0.10240.0 引進)
|
API contract |
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)
|
範例
#include <winrt/Windows.Graphics.Display.h>
using namespace winrt;
using namespace Windows::Graphics::Display;
...
void GameRenderer::Initialize()
{
DisplayProperties::StereoEnabledChanged({ this, &GameRenderer::OnStereoEnableChanged });
}
void GameRenderer::OnStereoEnableChanged(winrt::Windows::Foundation::IInspectable const& sender)
{
UpdateForStereoChange();
}
void GameRenderer::Initialize()
{
DisplayProperties::StereoEnabledChanged +=
ref new DisplayPropertiesEventHandler(this, &GameRenderer::OnStereoEnableChanged);
}
void GameRenderer::OnStereoEnableChanged(_In_ Platform::Object^ sender)
{
UpdateForStereoChange();
}
備註
我們建議應用程式使用單一委派來處理大部分的顯示事件,因為在大部分情況下,每個顯示內容的變更都需要應用程式重新繪製本身。 此外,許多屬性變更都來自影響整個作業系統的單一模式變更。
Direct3D 11.1 簡單身歷聲 3D 範例示範如何處理系統身歷聲變更。