.NET Framework Class Library
Renderer..::.Draw Method (Bitmap, Strokes)

Draws the Strokes collection on the specified Bitmap.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)
Syntax

Visual Basic (Declaration)
Public Sub Draw ( _
    destinationBitmap As Bitmap, _
    strokes As Strokes _
)
Visual Basic (Usage)
Dim instance As Renderer
Dim destinationBitmap As Bitmap
Dim strokes As Strokes

instance.Draw(destinationBitmap, strokes)
C#
public void Draw(
    Bitmap destinationBitmap,
    Strokes strokes
)
Visual C++
public:
void Draw(
    Bitmap^ destinationBitmap, 
    Strokes^ strokes
)
JScript
public function Draw(
    destinationBitmap : Bitmap, 
    strokes : Strokes
)

Parameters

destinationBitmap
Type: System.Drawing..::.Bitmap
Specified Bitmap to draw on.
strokes
Type: Microsoft.Ink..::.Strokes
The Strokes collection to draw.
Examples

In this example, the entire Strokes collection from an Ink object associated with an InkOverlay object is drawn on to a bitmap image that has been loaded from a file.

Calling the Draw method does not display the image and the strokes. Instead, it merges the stroke rendering data with the bitmap image data in preparation for display. The bitmap image (now modified with stroke renderering data) is made visible by calling the DrawImage method of the Graphics object associated with a Panel object.

Visual Basic
' 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()
C#
// 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();
Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information

.NET Framework

Supported in: 3.0
See Also

Reference

Tags :


Page view tracker