Bagikan melalui


Renderer.Draw Method (Bitmap, Stroke)

Draws the Stroke on the specified Bitmap.

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

Syntax

'Declaration
Public Sub Draw ( _
    destinationBitmap As Bitmap, _
    stroke As Stroke _
)
'Usage
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 function Draw(
    destinationBitmap : Bitmap, 
    stroke : Stroke
)

Parameters

Examples

In this example, a Stroke object is created in an Ink object. The stroke runs from the top left corner of the ink area to a point diagonally 5000 HIMETRIC units to the right and down from the top left corner.

Once created, the stroke 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 stroke. 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.

' 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();

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

Renderer Class

Renderer Members

Draw Overload

Microsoft.Ink Namespace