BufferedGraphicsContext.Allocate Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Skapar en grafikbuffert.
Överlagringar
| Name | Description |
|---|---|
| Allocate(Graphics, Rectangle) |
Skapar en grafikbuffert av den angivna storleken med pixelformatet för den angivna Graphics. |
| Allocate(IntPtr, Rectangle) |
Skapar en grafikbuffert av den angivna storleken med pixelformatet för den angivna Graphics. |
Allocate(Graphics, Rectangle)
Skapar en grafikbuffert av den angivna storleken med pixelformatet för den angivna 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
Parametrar
Returer
En BufferedGraphics som kan användas för att rita till en buffert av de angivna dimensionerna.
Exempel
I följande kodexempel visas hur du skapar en grafikbuffert med hjälp av Allocate metoden . Den här koden är en del av ett större exempel som tillhandahålls BufferedGraphics för klassen.
// 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))
Kommentarer
När du anropar Allocate metoden med en rektangel vars storlek överskrider värdet MaximumBuffer för egenskapen skapas en tillfällig BufferedGraphicsContext för att allokera bufferten och tillhandahålla en tillfällig kontext för bufferten. Det nya BufferedGraphicsContext är skilt från BufferedGraphicsContext för programdomänen och tas bort automatiskt när den BufferedGraphics som returneras av Allocate metoden tas bort.
Se även
Gäller för
Allocate(IntPtr, Rectangle)
Skapar en grafikbuffert av den angivna storleken med pixelformatet för den angivna 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
Parametrar
- targetDC
-
IntPtr
nativeint
En IntPtr till en enhetskontext som ska matcha pixelformatet för den nya bufferten till.
Returer
En BufferedGraphics som kan användas för att rita till en buffert av de angivna dimensionerna.
Exempel
I följande kodexempel visas hur du skapar en grafikbuffert med hjälp av Allocate metoden . Den här koden är en del av ett större exempel som tillhandahålls BufferedGraphics för klassen.
// 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))
Kommentarer
När du anropar Allocate metoden med en rektangel vars storlek överskrider värdet MaximumBuffer för egenskapen skapas en tillfällig BufferedGraphicsContext för att allokera bufferten och tillhandahålla en tillfällig kontext för bufferten. Det nya BufferedGraphicsContext är skilt från BufferedGraphicsContext för programdomänen och tas bort automatiskt när den BufferedGraphics som returneras av Allocate metoden tas bort.