語言

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 物件代表一個用於二維空間變換的 3x3 矩陣。 Stroke 物件的每個點都會被所提供的矩陣轉換。 例如,如果原本的 Point.X 值是 100,原本的 Point.Y 值是 55,轉換 Matrix.Scale(0.5, 0.5),那麼新的 Point.X 值是 50,新的 Point.Y 值是 27.5。

適用於