如何:手動管理已緩衝的圖形

針對更進階的雙重緩衝案例,您可以使用 .NET Framework 類別來實作您自己的雙緩衝邏輯。 負責配置和管理個別圖形緩衝區的類別是 BufferedGraphicsContext 類別。 每個應用程式都有自己的預設值 BufferedGraphicsContext ,可管理該應用程式的所有預設雙重緩衝處理。 您可以呼叫 來擷取這個實例的 Current 參考。

取得預設 BufferedGraphicsCoNtext 的參考

建立專用的 BufferedGraphicsCoNtext

  • 宣告並建立 類別的新實例 BufferedGraphicsContext ,如下列程式碼範例所示。

    BufferedGraphicsContext myContext;
    myContext = new BufferedGraphicsContext();
    // Insert code to create graphics here.
    // On a non-default BufferedGraphicsContext instance, you should always
    // call Dispose when finished.
    myContext.Dispose();
    
    Dim myContext As BufferedGraphicsContext
    myContext = New BufferedGraphicsContext
    ' Insert code to create graphics here.
    ' On a nondefault BufferedGraphicsContext instance, you should always 
    ' call Dispose when finished.
    myContext.Dispose()
    
    

另請參閱