HOW TO:手動管理已緩衝的圖形How to: Manually Manage Buffered Graphics

針對更進階雙重緩衝案例,您可以使用.NET Framework 類別來實作您自己的雙重緩衝邏輯。For more advanced double buffering scenarios, you can use the .NET Framework classes to implement your own double-buffering logic. 負責配置和管理個別圖形緩衝區的類別是BufferedGraphicsContext類別。The class responsible for allocating and managing individual graphics buffers is the BufferedGraphicsContext class. 每個應用程式有自己的預設值BufferedGraphicsContext可管理的所有預設雙重緩衝該應用程式。Every application has its own default BufferedGraphicsContext that manages all of the default double buffering for that application. 您可以擷取此執行個體的參考,藉由呼叫CurrentYou can retrieve a reference to this instance by calling the Current.

若要取得預設 BufferedGraphicsContext 的參考To obtain a reference to the default BufferedGraphicsContext

若要建立專用的 BufferedGraphicsContextTo create a dedicated BufferedGraphicsContext

  • 宣告和建立的新執行個體BufferedGraphicsContext類別,如下列程式碼範例所示。Declare and create a new instance of the BufferedGraphicsContext class, as shown in the following code example.

    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()
    
    

另請參閱See also