Condividi tramite


Metodo Strokes.Transform (Matrix, Boolean)

Aggiornamento: novembre 2007

Applica una trasformazione lineare a un insieme Strokes con la possibilità di applicare la trasformazione allo spessore della penna.

Spazio dei nomi:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Sintassi

'Dichiarazione
Public Sub Transform ( _
    inkTransform As Matrix, _
    applyOnPenWidth As Boolean _
)
'Utilizzo
Dim instance As Strokes
Dim inkTransform As Matrix
Dim applyOnPenWidth As Boolean

instance.Transform(inkTransform, applyOnPenWidth)
public void Transform(
    Matrix inkTransform,
    bool applyOnPenWidth
)
public:
void Transform(
    Matrix^ inkTransform, 
    bool applyOnPenWidth
)
public void Transform(
    Matrix inkTransform,
    boolean applyOnPenWidth
)
public function Transform(
    inkTransform : Matrix, 
    applyOnPenWidth : boolean
)

Parametri

  • applyOnPenWidth
    Tipo: System.Boolean
    Valore booleano che indica se applicare la trasformazione allo spessore dell'input penna nell'oggetto DrawingAttributes degli oggetti Stroke nell'insieme Strokes.

    Valore

    Significato

    true

    La trasformazione viene applicata sia ai punti, sia allo spessore della penna.

    false

    La trasformazione viene applicata solo ai punti.

Note

La trasformazione lineare può rappresentare ridimensionamento, rotazione, conversione e combinazioni di trasformazioni.

Se lo spessore della penna viene ridimensionato in modo appropriato per la trasformazione, lo spessore della penna disegnato viene calcolato moltiplicando lo spessore della penna specificato (o, in caso contrario, il valore predefinito 53) per la radice quadrata del determinante della trasformazione.

Esempi

In questo esempio, l'insieme Strokes associato a un oggetto InkOverlay viene ridimensionato di un fattore di due. Il ridimensionamento viene eseguito attorno al centro del riquadro dell'insieme Strokes. Lo spessore dell'input penna viene ridimensionato anche in base a un fattore pari a due.

' 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)
    ' Scale by factor of 2
    inkTransform.Scale(2.0F, 2.0F)
    ' Translate back
    inkTransform.Translate(-center.X, -center.Y)
    ' Transform strokes
    allStrokes.Transform(inkTransform, True)
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);
    // Scale by factor of 2
    inkTransform.Scale(2.0F, 2.0F);
    // Translate back
    inkTransform.Translate(-center.X, -center.Y);
    // Transform strokes
    allStrokes.Transform(inkTransform, true);
}

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

Vedere anche

Riferimenti

Strokes Classe

Membri Strokes

Overload Transform

Spazio dei nomi Microsoft.Ink

Strokes.Scale

Strokes.Move

Strokes.Rotate

Stroke.Transform