言語

Stroke.Transform(Matrix, Boolean) メソッド

定義

指定した Matrix オブジェクトに基づいて変換を実行します。

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)

パラメーター

transformMatrix
Matrix

変換を定義する Matrix オブジェクト。

applyToStylusTip
Boolean

true スタイラスの先端に変換を適用するには、それ以外の場合は false

次の例では、 Stroke オブジェクトを変換する方法を示します。

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

注釈

Matrix オブジェクトは、2 次元空間での変換に使用される 3x3 行列を表します。 Stroke オブジェクトの各ポイントは、指定された Matrix によって変換されます。 たとえば、元の Point.X 値が 100、元の Point.Y 値が 55、変換 Matrix.Scale(0.5, 0.5) の場合、新しい Point.X 値は 50、新しい Point.Y 値は 27.5 です。

適用対象