StrokeCollection.Transform Method (Matrix, Boolean)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Modifies each of the StylusPoints and optionally the StylusTipTransform for each stroke in the StrokeCollection according to the specified Matrix.

Namespace:   System.Windows.Ink
Assembly:  PresentationCore (in PresentationCore.dll)

public void Transform(
	Matrix transformMatrix,
	bool applyToStylusTip


Type: System.Windows.Media.Matrix

A Matrix which specifies the transformation to perform on the StrokeCollection.

Type: System.Boolean

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

When applyToStylusTip is true, the Transform method affects the shape of the stylus tip, as well as the position of the strokes. For example, if you rotate a StrokeCollection 90 degrees, the strokes move around an axis and the height and width of the strokes appear to be inverted.

The following example demonstrates how to move all the strokes on an InkCanvas. This example assumes that there is an InkCanvas called inkCanvas1.

// Move all the strokes on the InkCanvas to the right.
private void MoveStrokes_Click(object sender, RoutedEventArgs e)
    Matrix moveMatrix = new Matrix(1, 0, 0, 1, 20, 0);

    inkCanvas1.Strokes.Transform(moveMatrix, false);

.NET Framework
Available since 3.0
Return to top