Metodo Renderer.Draw (Bitmap, Stroke)
Aggiornamento: novembre 2007
Disegna l'oggetto Stroke sull'oggetto Bitmap specificato.
Spazio dei nomi: Microsoft.Ink
Assembly: Microsoft.Ink (in Microsoft.Ink.dll)
Sintassi
'Dichiarazione
Public Sub Draw ( _
destinationBitmap As Bitmap, _
stroke As Stroke _
)
'Utilizzo
Dim instance As Renderer
Dim destinationBitmap As Bitmap
Dim stroke As Stroke
instance.Draw(destinationBitmap, stroke)
public void Draw(
Bitmap destinationBitmap,
Stroke stroke
)
public:
void Draw(
Bitmap^ destinationBitmap,
Stroke^ stroke
)
public void Draw(
Bitmap destinationBitmap,
Stroke stroke
)
public function Draw(
destinationBitmap : Bitmap,
stroke : Stroke
)
Parametri
- destinationBitmap
Tipo: System.Drawing.Bitmap
Oggetto Bitmap specificato sul quale disegnare.
- stroke
Tipo: Microsoft.Ink.Stroke
Oggetto Stroke da disegnare.
Esempi
In questo esempio viene creato un oggetto Stroke in un oggetto Ink. Il tratto viene eseguito dall'angolo superiore sinistro dell'area di input penna in direzione diagonale verso un punto distante 5000 unità HIMETRIC in basso a destra.
Una volta creato, il tratto viene tracciato su un'immagine bitmap caricata da un file. Chiamando il metodo Draw non si visualizzano l'immagine e il tratto. 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.
' create a stroke
Dim strokePoints() As Point = {New Point(0), New Point(5000, 5000)}
Dim oneStroke As Stroke = mInkOverlay.Ink.CreateStroke(strokePoints)
' 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 on the bitmap
mInkOverlay.Renderer.Draw(bgImage, oneStroke)
' now display the bitmap (with the stroke) on the panel
Using g As Graphics = Me.panelForDraw.CreateGraphics()
g.DrawImage(bgImage, 0, 0)
End Using
bgImage.Dispose()
// create a stroke
Point[] strokePoints = new Point[2] { new Point(0), new Point(5000, 5000) };
Stroke oneStroke = mInkOverlay.Ink.CreateStroke(strokePoints);
// 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 on the bitmap
mInkOverlay.Renderer.Draw(bgImage, oneStroke);
// now display the bitmap (with the stroke) 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