D3DImage.IsFrontBufferAvailable Proprietà

Definizione

Ottiene un valore che indica se un front buffer esiste.

public:
 property bool IsFrontBufferAvailable { bool get(); };
public bool IsFrontBufferAvailable { get; }
member this.IsFrontBufferAvailable : bool
Public ReadOnly Property IsFrontBufferAvailable As Boolean

Valore della proprietà

true se un front buffer esiste; in caso contrario, false.

Esempio

Nell'esempio di codice seguente viene illustrato come controllare la proprietà durante il IsFrontBufferAvailable rendering della destinazione di composizione. Per altre informazioni, vedere Procedura dettagliata: Hosting di contenuto Direct3D9 in WPF.

void CompositionTarget_Rendering(object sender, EventArgs e)
{
    RenderingEventArgs args = (RenderingEventArgs)e;

    // It's possible for Rendering to call back twice in the same frame 
    // so only render when we haven't already rendered in this frame.
    if (d3dimg.IsFrontBufferAvailable && _lastRender != args.RenderingTime)
    {
        IntPtr pSurface = IntPtr.Zero;
        HRESULT.Check(GetBackBufferNoRef(out pSurface));
        if (pSurface != IntPtr.Zero)
        {
            d3dimg.Lock();
            // Repeatedly calling SetBackBuffer with the same IntPtr is 
            // a no-op. There is no performance penalty.
            d3dimg.SetBackBuffer(D3DResourceType.IDirect3DSurface9, pSurface);
            HRESULT.Check(Render());
            d3dimg.AddDirtyRect(new Int32Rect(0, 0, d3dimg.PixelWidth, d3dimg.PixelHeight));
            d3dimg.Unlock();

            _lastRender = args.RenderingTime;
        }
    }
}

Commenti

Occasionalmente, il buffer anteriore non è disponibile. Questa mancanza di disponibilità può essere causata dal blocco dello schermo, dalle applicazioni Direct3D esclusive a schermo intero, dal cambio utente o da altre attività di sistema. In questo caso, l'applicazione WPF viene notificata gestendo l'evento IsFrontBufferAvailableChanged . Il modo in cui l'applicazione risponde al buffer anteriore che diventa non disponibile dipende dal fatto che WPF sia abilitato per il fallback al rendering software. Il SetBackBuffer metodo ha un overload che accetta un parametro che specifica se WPF torna al rendering software. Per altre informazioni, vedere le osservazioni nella D3DImage classe.

Informazioni proprietà di dipendenza

Campo Identificatore IsFrontBufferAvailableProperty
Proprietà dei metadati impostate su true Nessuno

Si applica a

Vedi anche