Share via


Stroke.Transform(Matrix, Boolean) Methode

Definition

Führt eine Transformation auf Grundlage des angegebenen Matrix-Objekts aus.

public:
 virtual void Transform(System::Windows::Media::Matrix transformMatrix, bool applyToStylusTip);
public virtual void Transform (System.Windows.Media.Matrix transformMatrix, bool applyToStylusTip);
abstract member Transform : System.Windows.Media.Matrix * bool -> unit
override this.Transform : System.Windows.Media.Matrix * bool -> unit
Public Overridable Sub Transform (transformMatrix As Matrix, applyToStylusTip As Boolean)

Parameter

transformMatrix
Matrix

Das Matrix-Objekt, das die Transformation definiert.

applyToStylusTip
Boolean

true, um die Transformation für die Tablettstiftspitze zu übernehmen, andernfalls false.

Beispiele

Im folgenden Beispiel wird veranschaulicht, wie ein Stroke Objekt transformiert wird.

protected DrawingVisual DrawDCOnly(Stroke myStroke)
{
    // Create new Visual context to draw on
    DrawingVisual myVisual = new DrawingVisual();
    DrawingContext myContext = myVisual.RenderOpen();

    // myMatrix is scaled by:
    // myMatrix.Scale(0.5, 0.5)
    myStroke.Transform(myMatrix, false);

    // Draw the stroke on the Visual context using DrawingContext
    myStroke.Draw(myContext);

    // Close the context
    myContext.Close();

    return myVisual;
}
Function DrawDCOnly(ByVal myStroke As Stroke) As DrawingVisual

    ' Create new Visual context to draw on
    Dim myVisual As DrawingVisual = New DrawingVisual()
    Dim myContext As DrawingContext = myVisual.RenderOpen()

    ' myMatrix is scaled by:
    ' myMatrix.Scale(0.5, 0.5)
    myStroke.Transform(myMatrix, False)

    ' Draw the stroke on the Visual context using DrawingContext
    myStroke.Draw(myContext)

    ' Close the context
    myContext.Close()

    Return myVisual

End Function

Hinweise

Das Matrix Objekt stellt eine 3x3-Matrix dar, die für Transformationen im zweidimensionalen Raum verwendet wird. Jeder Punkt des Stroke-Objekts wird von der angegebenen Matrix transformiert. Wenn beispielsweise der ursprüngliche Punkt.X-Wert 100 ist, ist der ursprüngliche Punkt.Y-Wert 55, und die Transformation Matrix.Scale(0,5, 0,5), der neue Punkt.X-Wert ist 50, und der neue Punkt.Y-Wert ist 27,5.

Gilt für