Taal

Stroke.Transform(Matrix, Boolean) Methode

Definitie

Voert een transformatie uit op basis van het opgegeven Matrix object.

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)

Parameters

transformMatrix
Matrix

Het Matrix object dat de transformatie definieert.

applyToStylusTip
Boolean

true om de transformatie toe te passen op de tip van de stylus; anders, false.

Voorbeelden

In het volgende voorbeeld ziet u hoe u een Stroke object transformeert.

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

Opmerkingen

Het Matrix object vertegenwoordigt een 3x3-matrix die wordt gebruikt voor transformaties in tweedimensionale ruimte. Elk punt van het stroke-object wordt getransformeerd door de opgegeven matrix. Als de oorspronkelijke punt.X-waarde bijvoorbeeld 100 is, is de oorspronkelijke punt.Y-waarde 55 en is de transformatie Matrix.Scale(0,5, 0,5), de nieuwe punt.X-waarde 50 en de nieuwe punt.Y-waarde is 27,5.

Van toepassing op