BufferedGraphicsContext BufferedGraphicsContext BufferedGraphicsContext BufferedGraphicsContext Class

定義

提供建立圖形緩衝區的方法,該緩衝區可用於雙重緩衝 (Double Buffering)。Provides methods for creating graphics buffers that can be used for double buffering.

public ref class BufferedGraphicsContext sealed : IDisposable
public sealed class BufferedGraphicsContext : IDisposable
type BufferedGraphicsContext = class
    interface IDisposable
Public NotInheritable Class BufferedGraphicsContext
Implements IDisposable
繼承
BufferedGraphicsContextBufferedGraphicsContextBufferedGraphicsContextBufferedGraphicsContext
實作

範例

下列程式碼範例示範如何取得BufferedGraphicsContext目前的應用程式定義域。The following code example demonstrates how to acquire the BufferedGraphicsContext for the current application domain. 此程式碼是針對提供之較大範例的一部分BufferedGraphics類別。This code is part of a larger example provided for the BufferedGraphics class.

// Retrieves the BufferedGraphicsContext for the 
// current application domain.
BufferedGraphicsContext^ appDomainGraphicsContext =
   BufferedGraphicsManager::Current;
// Retrieves the BufferedGraphicsContext for the 
// current application domain.
BufferedGraphicsContext appDomainGraphicsContext = 
     BufferedGraphicsManager.Current;
' Retrieves the BufferedGraphicsContext for the 
' current application domain.
Dim appDomainGraphicsContext As BufferedGraphicsContext = BufferedGraphicsManager.Current

備註

BufferedGraphicsContext類別可讓您實作圖形的自訂雙重緩衝。The BufferedGraphicsContext class allows you to implement custom double buffering for your graphics. 使用雙重緩衝的圖形可以減少或消除因重繪顯示表面的閃爍。Graphics that use double buffering can reduce or eliminate flicker that is caused by redrawing a display surface.

注意

使用雙重緩衝的最簡單方式是設定OptimizedDoubleBuffer控制項上使用控制項的樣式旗標SetStyle方法。The simplest way to use double buffering is to set the OptimizedDoubleBuffer control style flag on a control using the SetStyle method. 設定OptimizedDoubleBuffer控制控制項的樣式旗標將所有繪製控制項的預設圖形緩衝區中,透過重新都導向而不需要任何額外的程式碼。Setting the OptimizedDoubleBuffer control styles flag for a control redirects all painting for the control through a default graphics buffer, without requiring any additional code. 若要設定此旗標true預設。This flag is set to true by default.

BufferedGraphicsContext類別提供方法來建立和設定的圖形緩衝區。The BufferedGraphicsContext class provides methods for creating and configuring a graphics buffer. Allocate方法會建立BufferedGraphics,這是也會提供您可用來寫入至緩衝區以及轉譯其內容以輸出裝置方法的圖形緩衝區的包裝函式。The Allocate method creates a BufferedGraphics, which is a wrapper for a graphics buffer that also provides methods you can use to write to the buffer and render its contents to an output device.

您可以擷取BufferedGraphicsContext目前的應用程式定義域,靜態BufferedGraphicsManager.Current屬性。You can retrieve the BufferedGraphicsContext for the current application domain from the static BufferedGraphicsManager.Current property. 對於大量繪圖應用程式,例如動畫,您可以建立專用BufferedGraphicsContext使用建構函式,但大部分的應用程式BufferedGraphicsManager.Current屬性即可。For graphically intensive applications such as animation, you can create a dedicated BufferedGraphicsContext using the constructor, but for most applications the BufferedGraphicsManager.Current property will be sufficient.

如需有關繪圖已緩衝的圖形和緩衝處理的自訂實作的詳細資訊,請參閱雙重緩衝的圖形How to:手動管理已緩衝的圖形For more information on drawing buffered graphics and custom buffering implementations, see Double Buffered Graphics and How to: Manually Manage Buffered Graphics.

建構函式

BufferedGraphicsContext() BufferedGraphicsContext() BufferedGraphicsContext() BufferedGraphicsContext()

初始化 BufferedGraphicsContext 類別的新執行個體。Initializes a new instance of the BufferedGraphicsContext class.

屬性

MaximumBuffer MaximumBuffer MaximumBuffer MaximumBuffer

取得或設定要使用之緩衝區的大小上限。Gets or sets the maximum size of the buffer to use.

方法

Allocate(Graphics, Rectangle) Allocate(Graphics, Rectangle) Allocate(Graphics, Rectangle) Allocate(Graphics, Rectangle)

使用指定 Graphics 的像素格式,建立指定大小的圖形緩衝區。Creates a graphics buffer of the specified size using the pixel format of the specified Graphics.

Allocate(IntPtr, Rectangle) Allocate(IntPtr, Rectangle) Allocate(IntPtr, Rectangle) Allocate(IntPtr, Rectangle)

使用指定 Graphics 的像素格式,建立指定大小的圖形緩衝區。Creates a graphics buffer of the specified size using the pixel format of the specified Graphics.

Dispose() Dispose() Dispose() Dispose()

釋放 BufferedGraphicsContext 所使用的所有資源。Releases all resources used by the BufferedGraphicsContext.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
Finalize() Finalize() Finalize() Finalize()

允許物件在記憶體回收進行回收之前,嘗試釋放資源並執行其他清除作業。Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
Invalidate() Invalidate() Invalidate() Invalidate()

處置目前的圖形緩衝區,如果已配置緩衝區但尚未處置的話。Disposes of the current graphics buffer, if a buffer has been allocated and has not yet been disposed.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)

適用於

另請參閱