Metodo Renderer.Draw (Bitmap, Strokes)
Aggiornamento: novembre 2007
Disegna l'insieme Strokes sull'oggetto Bitmap specificato.
Spazio dei nomi: Microsoft.Ink
Assembly: Microsoft.Ink (in Microsoft.Ink.dll)
Sintassi
'Dichiarazione
Public Sub Draw ( _
destinationBitmap As Bitmap, _
strokes As Strokes _
)
'Utilizzo
Dim instance As Renderer
Dim destinationBitmap As Bitmap
Dim strokes As Strokes
instance.Draw(destinationBitmap, strokes)
public void Draw(
Bitmap destinationBitmap,
Strokes strokes
)
public:
void Draw(
Bitmap^ destinationBitmap,
Strokes^ strokes
)
public void Draw(
Bitmap destinationBitmap,
Strokes strokes
)
public function Draw(
destinationBitmap : Bitmap,
strokes : Strokes
)
Parametri
- destinationBitmap
Tipo: System.Drawing.Bitmap
Oggetto Bitmap specificato sul quale disegnare.
- strokes
Tipo: Microsoft.Ink.Strokes
Insieme Strokes da disegnare.
Esempi
In questo esempio l'intero insieme Strokes di un oggetto Ink associato a un oggetto InkOverlay viene disegnato in un'immagine bitmap caricata da un file.
Chiamando il metodo Draw non si visualizzano l'immagine e i tratti. I dati di rendering del tratto vengono invece uniti ai dati dell'immagine bitmap in preparazione per la visualizzazione. L'immagine bitmap (appena modificata con i dati di rendering del tratto) viene resa visibile chiamando il metodo DrawImage dell'oggetto Graphics associato a un oggetto Panel.
' get the Bitmap object loaded from a file
' scale the image to match the panel size
Dim bgImage As Bitmap = New Bitmap(New Bitmap(imageFileName), Me.panelForDraw.Size)
' place (draw) the stroke collection on the bitmap
' Access to the Ink.Strokes property returns a copy of the Strokes object.
' This copy must be implicitly (via using statement) or explicitly
' disposed of in order to avoid a memory leak.
Using allStrokes As Strokes = mInkOverlay.Ink.Strokes
mInkOverlay.Renderer.Draw(bgImage, allStrokes)
End Using
' now display the bitmap (with the strokes) on the panel
Using g As Graphics = Me.panelForDraw.CreateGraphics()
g.DrawImage(bgImage, 0, 0)
End Using
bgImage.Dispose()
// get the Bitmap object loaded from a file
// scale the image to match the panel size
Bitmap bgImage = new Bitmap(new Bitmap(imageFileName), this.panelForDraw.Size);
// place (draw) the stroke collection on the bitmap
// Access to the Ink.Strokes property returns a copy of the Strokes object.
// This copy must be implicitly (via using statement) or explicitly
// disposed of in order to avoid a memory leak.
using (Strokes allStrokes = mInkOverlay.Ink.Strokes)
{
mInkOverlay.Renderer.Draw(bgImage, allStrokes);
}
// now display the bitmap (with the strokes) on the panel
using (Graphics g = this.panelForDraw.CreateGraphics())
{
g.DrawImage(bgImage,0,0);
}
bgImage.Dispose();
Piattaforme
Windows Vista
.NET Framework e .NET Compact Framework non supportano tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.
Informazioni sulla versione
.NET Framework
Supportato in: 3.0