Compartir a través de


Strokes.Transform (Método) (Matrix)

Actualización: noviembre 2007

Aplica una transformación lineal a una colección Strokes, sin que afecte al ancho de la pluma.

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

Sintaxis

'Declaración
Public Sub Transform ( _
    inkTransform As Matrix _
)
'Uso
Dim instance As Strokes
Dim inkTransform As Matrix

instance.Transform(inkTransform)
public void Transform(
    Matrix inkTransform
)
public:
void Transform(
    Matrix^ inkTransform
)
public void Transform(
    Matrix inkTransform
)
public function Transform(
    inkTransform : Matrix
)

Parámetros

Comentarios

La transformación se aplica a los puntos, pero no al ancho de la pluma. Para establecer un valor que incluya el ancho de la pluma en la transformación, utilice la sobrecarga Transform(Matrix, Boolean) de este método.

La transformación lineal puede representar el ajuste de escala, la rotación, la traslación y combinaciones de transformaciones.

Ejemplos

En este ejemplo, la colección Strokes asociada a un objeto InkOverlay se gira 180 grados. El giro se produce alrededor del centro del cuadro de límite de la colección Strokes.

' Access to the 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

    Dim inkTransform As Matrix = New Matrix()
    Dim bounds As Rectangle = allStrokes.GetBoundingBox()
    Dim center As PointF = _
        New PointF(0.5F * (bounds.Left + bounds.Right), _
                   0.5F * (bounds.Top + bounds.Bottom))
    ' Translate to center of bounding box
    inkTransform.Translate(center.X, center.Y)
    ' Rotate by 180 degrees
    inkTransform.Rotate(180.0F)
    ' Translate back
    inkTransform.Translate(-center.X, -center.Y)
    ' Transform strokes
    allStrokes.Transform(inkTransform)
End Using
// Access to the 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)
{
    Matrix inkTransform = new Matrix();
    Rectangle bounds = allStrokes.GetBoundingBox();
    PointF center = new PointF(0.5f * (bounds.Left + bounds.Right),
                               0.5f * (bounds.Top + bounds.Bottom));
    // Translate to center of bounding box
    inkTransform.Translate(center.X, center.Y);
    // Rotate by 180 degrees
    inkTransform.Rotate(180f);
    // Translate back
    inkTransform.Translate(-center.X, -center.Y);
    // Transform strokes
    allStrokes.Transform(inkTransform);
}

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

Strokes (Clase)

Strokes (Miembros)

Transform (Sobrecarga)

Microsoft.Ink (Espacio de nombres)

Strokes.Scale

Strokes.Move

Strokes.Rotate

Stroke.Transform