StrokeCollection.Transform(Matrix, Boolean) 方法

定义

根据指定的 StylusPoints,修改每一个 StylusTipTransform,并可选地修改 StrokeCollection 中每一条笔画的 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)

参数

transformMatrix
Matrix

一个 Matrix,指定要对 StrokeCollection 执行的转换。

applyToStylusTip
Boolean

如果要将变换应用到触笔的笔尖,则为 true;否则为 false

示例

下面的示例演示如何移动上 InkCanvas的所有笔划。 此示例假定有一个 InkCanvas 调用 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

注解

applyToStylusTiptrue时,该方法 Transform 会影响触笔尖的形状以及笔划的位置。 例如,如果旋转 StrokeCollection 90 度,笔划会绕轴移动,笔划的高度和宽度似乎反转。

适用于