BufferedGraphicsContext.Allocate 方法

定義

建立圖形緩衝區。

多載

Allocate(Graphics, Rectangle)

使用指定 Graphics 的像素格式,建立指定大小的圖形緩衝區。

Allocate(IntPtr, Rectangle)

使用指定 Graphics 的像素格式,建立指定大小的圖形緩衝區。

Allocate(Graphics, Rectangle)

來源:
BufferedGraphicsContext.cs
來源:
BufferedGraphicsContext.cs
來源:
BufferedGraphicsContext.cs

使用指定 Graphics 的像素格式,建立指定大小的圖形緩衝區。

public:
 System::Drawing::BufferedGraphics ^ Allocate(System::Drawing::Graphics ^ targetGraphics, System::Drawing::Rectangle targetRectangle);
public System.Drawing.BufferedGraphics Allocate (System.Drawing.Graphics targetGraphics, System.Drawing.Rectangle targetRectangle);
member this.Allocate : System.Drawing.Graphics * System.Drawing.Rectangle -> System.Drawing.BufferedGraphics
Public Function Allocate (targetGraphics As Graphics, targetRectangle As Rectangle) As BufferedGraphics

參數

targetGraphics
Graphics

要與新緩衝區的像素格式相符之 Graphics

targetRectangle
Rectangle

Rectangle,指出要建立的緩衝區大小。

傳回

BufferedGraphics,可用於繪製到指定維度的緩衝區。

範例

下列程式代碼範例示範如何使用 Allocate 方法來建立圖形緩衝區。 此程式代碼是類別所提供較大範例的 BufferedGraphics 一部分。

// Allocates a graphics buffer using the pixel format 
// of the specified Graphics object.
grafx = appDomainBufferedGraphicsContext->Allocate( this->CreateGraphics(),
   Rectangle( 0, 0, 400, 400 ) );
// Allocates a graphics buffer using the pixel format
// of the specified Graphics object.
grafx = appDomainBufferedGraphicsContext.Allocate(this.CreateGraphics(),
     new Rectangle( 0, 0, 400, 400 ));
' Allocates a graphics buffer using the pixel format 
' of the specified Graphics object.
grafx = appDomainBufferedGraphicsContext.Allocate(Me.CreateGraphics(), New Rectangle(0, 0, 400, 400))

備註

當您使用大小超過 屬性值的MaximumBuffer矩形呼叫 Allocate 方法時,BufferedGraphicsContext會建立暫存來配置緩衝區並提供緩衝區的暫存內容。 新的 BufferedGraphicsContext 與應用程式域的 不同BufferedGraphicsContext,而且在處置 方法所Allocate傳回的 時BufferedGraphics,會自動處置它。

另請參閱

適用於

Allocate(IntPtr, Rectangle)

來源:
BufferedGraphicsContext.cs
來源:
BufferedGraphicsContext.cs
來源:
BufferedGraphicsContext.cs

使用指定 Graphics 的像素格式,建立指定大小的圖形緩衝區。

public:
 System::Drawing::BufferedGraphics ^ Allocate(IntPtr targetDC, System::Drawing::Rectangle targetRectangle);
public System.Drawing.BufferedGraphics Allocate (IntPtr targetDC, System.Drawing.Rectangle targetRectangle);
member this.Allocate : nativeint * System.Drawing.Rectangle -> System.Drawing.BufferedGraphics
Public Function Allocate (targetDC As IntPtr, targetRectangle As Rectangle) As BufferedGraphics

參數

targetDC
IntPtr

nativeint

一個指到裝置內容的 IntPtr,要與新緩衝區的像素格式相符。

targetRectangle
Rectangle

Rectangle,指出要建立的緩衝區大小。

傳回

BufferedGraphics,可用於繪製到指定維度的緩衝區。

範例

下列程式代碼範例示範如何使用 Allocate 方法來建立圖形緩衝區。 此程式代碼是類別所提供較大範例的 BufferedGraphics 一部分。

// Allocates a graphics buffer using the pixel format 
// of the specified handle to a device context.
grafx = appDomainBufferedGraphicsContext->Allocate( this->Handle,
   Rectangle( 0, 0, 400, 400 ) );
// Allocates a graphics buffer using the pixel format
// of the specified handle to a device context.
grafx = appDomainBufferedGraphicsContext.Allocate(this.Handle,
     new Rectangle( 0, 0, 400, 400 ));
' Allocates a graphics buffer using the pixel format 
' of the specified handle to device context.
grafx = appDomainBufferedGraphicsContext.Allocate(Me.Handle, New Rectangle(0, 0, 400, 400))

備註

當您使用大小超過 屬性值的MaximumBuffer矩形呼叫 Allocate 方法時,BufferedGraphicsContext會建立暫存來配置緩衝區並提供緩衝區的暫存內容。 新的 BufferedGraphicsContext 與應用程式域的 不同BufferedGraphicsContext,而且在處置 方法所Allocate傳回的 時BufferedGraphics,會自動處置它。

另請參閱

適用於