Sdílet prostřednictvím


Stroke.Transform(Matrix, Boolean) Metoda

Definice

Provede transformaci na základě zadaného Matrix objektu.

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)

Parametry

transformMatrix
Matrix

Objekt Matrix definující transformaci.

applyToStylusTip
Boolean

true použít transformaci na špičku pera; falsev opačném případě .

Příklady

Následující příklad ukazuje, jak transformovat Stroke objekt.

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

Poznámky

Objekt Matrix představuje matici 3x3 použitou pro transformace v dvojrozměrném prostoru. Každý bod objektu Tah je transformován zadanou maticí. Pokud je například původní hodnota Point.X 100, původní hodnota Point.Y je 55 a transformační matice.Scale(0,5; 0,5), je nová hodnota Point.X 50 a nová hodnota Point.Y je 27,5.

Platí pro