Compartir a través de


Renderer.Draw (Método) (Bitmap, Stroke)

Actualización: noviembre 2007

Dibuja el objeto Stroke en el objeto Bitmap especificado.

Espacio de nombres:  Microsoft.Ink
Ensamblado:  Microsoft.Ink (en Microsoft.Ink.dll)

Sintaxis

'Declaración
Public Sub Draw ( _
    destinationBitmap As Bitmap, _
    stroke As Stroke _
)
'Uso
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
)

Parámetros

Ejemplos

En este ejemplo, se crea un objeto Stroke en un objeto Ink. El trazo va desde la esquina superior izquierda del área de la entrada manuscrita hasta un punto en diagonal a 5000 unidades HIMETRIC a la derecha y hacia abajo desde la esquina superior izquierda.

Una vez creado, el trazo se dibuja en una imagen de mapa de bits que se ha cargado de un archivo. Si se llama al método Draw no se muestra la imagen ni el trazo. En su lugar, los datos de representación del trazo se combinan con los datos de la imagen de mapa de bits en preparación para la presentación. La imagen de mapa de bits (ahora modificada con los datos de representación del trazo) se hace visible llamando al método DrawImage del objeto Graphics asociado con un objeto 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();

Plataformas

Windows Vista

.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

Información de versión

.NET Framework

Compatible con: 3.0

Vea también

Referencia

Renderer (Clase)

Renderer (Miembros)

Draw (Sobrecarga)

Microsoft.Ink (Espacio de nombres)