Bagikan melalui


DisplayPropertiesEventHandler Delegasikan

Definisi

Catatan

Jenis DisplayProperties dan penanganan aktivitas terkait dapat diubah atau tidak tersedia untuk rilis setelah Windows 8.1. Sebagai gantinya, gunakan DisplayInformation.

Mewakili metode yang menangani peristiwa properti tampilan.

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)

Parameter

sender
Object

Platform::Object

IInspectable

Objek yang menaikkan peristiwa.

Atribut

Persyaratan Windows

Rangkaian perangkat
Windows 10 (diperkenalkan dalam 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (diperkenalkan dalam v1.0)

Contoh

#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();
}

Keterangan

Kami menyarankan agar aplikasi menggunakan satu delegasi untuk menangani sebagian besar peristiwa tampilan karena dalam banyak kasus, perubahan pada setiap properti tampilan mengharuskan aplikasi menggambar ulang dirinya sendiri. Selain itu, banyak perubahan properti yang dihasilkan dari perubahan mode tunggal yang memengaruhi seluruh sistem operasi.

Sampel 3D Stereo Sederhana Direct3D 11.1 menunjukkan cara menangani perubahan stereo sistem.

Berlaku untuk