Breyta

Deila með


Stroke.Transform(Matrix, Boolean) Method

Definition

Performs a transformation based upon the specified 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

The Matrix object defining the transformation.

applyToStylusTip
Boolean

true to apply the transformation to the tip of the stylus; otherwise, false.

Examples

The following example demonstrates how to transform a Stroke object.

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

Remarks

The Matrix object represents a 3x3 matrix used for transformations in two-dimensional space. Each point of the Stroke object is transformed by the supplied Matrix. For example if the original Point.X value is 100, the original Point.Y value is 55, and the transformation Matrix.Scale(0.5, 0.5), the new Point.X value is 50 and the new Point.Y value is 27.5.

Applies to