Metodo Strokes.Transform (Matrix)
Aggiornamento: novembre 2007
Applica una trasformazione lineare a un insieme Strokes senza influenza sullo spessore della penna.
Spazio dei nomi: Microsoft.Ink
Assembly: Microsoft.Ink (in Microsoft.Ink.dll)
Sintassi
'Dichiarazione
Public Sub Transform ( _
inkTransform As Matrix _
)
'Utilizzo
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
)
Parametri
- inkTransform
Tipo: System.Drawing.Drawing2D.Matrix
Trasformazione System.Drawing.Drawing2D.Matrix da utilizzare sull'insieme Strokes.
Note
La trasformazione viene applicata ai punti, ma non allo spessore della penna. Per impostare un valore che include lo spessore della penna nella trasformazione, utilizzare l'overload Transform(Matrix, Boolean) di questo metodo.
La trasformazione lineare può rappresentare ridimensionamento, rotazione, conversione e combinazioni di trasformazioni.
Esempi
In questo esempio, l'insieme Strokes associato a un oggetto InkOverlay viene ruotato di 180 gradi. La rotazione viene eseguita attorno al centro del riquadro dell'insieme 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);
}
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