Stroke.Transform(Matrix, Boolean) Methode

Definition

Führt eine Transformation basierend auf dem angegebenen Matrix Objekt 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

truedie Transformation auf die Spitze des Eingabestifts anzuwenden; 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, der ursprüngliche Punkt.Y-Wert 55 ist und die Transformation Matrix.Scale(0,5, 0,5), der neue Punkt.X-Wert 50 ist und der neue Punkt.Y-Wert 27,5 ist.

Gilt für: