แก้ไข

แชร์ผ่าน


StrokeCollection.Transform(Matrix, Boolean) Method

Definition

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

public:
 void Transform(System::Windows::Media::Matrix transformMatrix, bool applyToStylusTip);
public void Transform (System.Windows.Media.Matrix transformMatrix, bool applyToStylusTip);
member this.Transform : System.Windows.Media.Matrix * bool -> unit
Public Sub Transform (transformMatrix As Matrix, applyToStylusTip As Boolean)

Parameters

transformMatrix
Matrix

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

applyToStylusTip
Boolean

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

Examples

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);
}
' Move all the strokes on the InkCanvas to the right.
Private Sub MoveStrokes_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

    Dim moveMatrix As New Matrix(1, 0, 0, 1, 20, 0)

    inkCanvas1.Strokes.Transform(moveMatrix, False)

End Sub

Remarks

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.

Applies to