Rect.Transform メソッド

定義

指定した行列を使用して四角形を変換します。Transforms a rectangle by using the specified matrix.

オーバーロード

Transform(Matrix)

指定した行列を適用して四角形を変換します。Transforms the rectangle by applying the specified matrix.

Transform(Rect, Matrix)

指定した四角形に指定した行列を適用した四角形を返します。Returns the rectangle that results from applying the specified matrix to the specified rectangle.

Transform(Matrix)

指定した行列を適用して四角形を変換します。Transforms the rectangle by applying the specified matrix.

public:
 void Transform(System::Windows::Media::Matrix matrix);
public void Transform (System.Windows.Media.Matrix matrix);
member this.Transform : System.Windows.Media.Matrix -> unit
Public Sub Transform (matrix As Matrix)

パラメーター

matrix
Matrix

適用する変換を指定する行列。A matrix that specifies the transformation to apply.

次の例では、メソッドを使用し Transform(Matrix) て、を使用して構造体を変換する方法を示し Rect Matrix ます。The following example shows how to use the Transform(Matrix) method to transform a Rect structure by using a Matrix.

private Rect transformExample1()
{
    // Initialize new rectangle.
    Rect myRectangle = new Rect();

    // Set the Size property of the rectangle with a width of 200
    // and a height of 60.
    myRectangle.Size = new Size(200, 60);

    // Creating a Matrix structure.
    Matrix myMatrix = new Matrix(0, 1, 1, 0, 20, 2);

    // The Transform method transforms this rectangle using the specified matrix.  
    // myRectangle location changed from 0,0 to 20, 2 and the size changed from
    // 200,60 to 60,200.
    myRectangle.Transform(myMatrix);

    return myRectangle;
}

適用対象

Transform(Rect, Matrix)

指定した四角形に指定した行列を適用した四角形を返します。Returns the rectangle that results from applying the specified matrix to the specified rectangle.

public:
 static System::Windows::Rect Transform(System::Windows::Rect rect, System::Windows::Media::Matrix matrix);
public static System.Windows.Rect Transform (System.Windows.Rect rect, System.Windows.Media.Matrix matrix);
static member Transform : System.Windows.Rect * System.Windows.Media.Matrix -> System.Windows.Rect
Public Shared Function Transform (rect As Rect, matrix As Matrix) As Rect

パラメーター

rect
Rect

変換の基盤となる四角形。A rectangle that is the basis for the transformation.

matrix
Matrix

適用する変換を指定する行列。A matrix that specifies the transformation to apply.

戻り値

Rect

操作の結果生成される四角形。The rectangle that results from the operation.

次の例は、メソッドを使用して Transform(Rect, Matrix) Rect 、既存の四角形にを適用した結果として得られる新しい構造体を作成する方法を示して Matrix います。The following example shows how to use the Transform(Rect, Matrix) method to create a new Rect structure that results from applying a Matrix to an existing rectangle.

private Rect transformExample2()
{
    // Initialize new rectangle.
    Rect myRectangle = new Rect();

    // Set the Size property of the rectangle with a width of 200
    // and a height of 60.
    myRectangle.Size = new Size(200, 60);

    // Creating a Matrix structure.
    Matrix myMatrix = new Matrix(0, 1, 1, 0, 20, 2);

    // The Transform method Transforms the specified rectangle using the specified matrix 
    // and returns the results.  
    // resultRect is an alterned version of myRectangle with a location of 20,2 rather
    // then 0,0 and a size of 60,200 rather then 200,60.
    Rect resultRect = Rect.Transform(myRectangle,myMatrix);

    return resultRect;
}

適用対象