# MatrixMatrixMatrixMatrix Struct

## 定義

``public value class Matrix : IFormattable``
``````[System.ComponentModel.TypeConverter(typeof(System.Windows.Media.MatrixConverter))]
[System.Serializable]
public struct Matrix : IFormattable``````
``````type Matrix = struct
interface IFormattable``````
``````Public Structure Matrix
Implements IFormattable``````

MatrixMatrixMatrixMatrix

## 備註

3x3 矩陣用於2-D2-D x y 平面中的轉換。A 3x3 matrix is used for transformations in a 2-D2-D x-y plane. 仿射轉換矩陣可以相乘以形成任何數目的線性轉換, 例如旋轉和扭曲 (切變), 然後再進行轉譯。Affine transformation matrices can be multiplied to form any number of linear transformations, such as rotation and skew (shear), followed by translation. 仿射轉換矩陣的最後一個資料行等於 (0, 0, 1), 所以只需要指定前兩個數據行中的成員。An affine transformation matrix has its final column equal to (0, 0, 1), so only the members in the first two columns need to be specified. 請注意, 向量是以資料列向量表示, 而不是資料行向量。Note that vectors are expressed as row-vectors, not column vectors.

WPFWPF 會使用資料列主要順序來儲存,Matrix並具有下列結構:A WPFWPF Matrix is stored using row-major order and has the following structure:

M11 M12 00
M21 M22 00
OffsetX OffsetY 11

(M11, M12, M21, M22, OffsetX, OffsetY)(M11, M12, M21, M22, OffsetX, OffsetY)

### XAML Attribute UsageXAML Attribute Usage

``````<object property="m11, m12, m21, m22, offsetX, offsetY"/>
- or -
<object property="Identity"/>
``````

m11m11
System.Double

m12m12
System.Double

m21m21
System.Double

m22m22
System.Double

offsetXoffsetX
System.Double

offsetYoffsetY
System.Double

## 建構函式

 Matrix(Double, Double, Double, Double, Double, Double) Matrix(Double, Double, Double, Double, Double, Double) Matrix(Double, Double, Double, Double, Double, Double) Matrix(Double, Double, Double, Double, Double, Double) 初始化 Matrix 結構的新執行個體。Initializes a new instance of the Matrix structure.

## 屬性

 Determinant Determinant Determinant Determinant 取得這個 Matrix 結構的行列式。Gets the determinant of this Matrix structure. HasInverse HasInverse HasInverse HasInverse 取得值，這個值表示這個 Matrix 結構是否可以反轉。Gets a value that indicates whether this Matrix structure is invertible. Identity Identity Identity Identity 取得單位 Matrix。Gets an identity Matrix. IsIdentity IsIdentity IsIdentity IsIdentity 取得值，這個值表示這個 Matrix 結構是否為單位矩陣。Gets a value that indicates whether this Matrix structure is an identity matrix. M11 M11 M11 M11 取得或設定這個 Matrix 之結構第一列第一行的值。Gets or sets the value of the first row and first column of this Matrix structure. M12 M12 M12 M12 取得或設定這個 Matrix 結構之第一列第二行的值。Gets or sets the value of the first row and second column of this Matrix structure. M21 M21 M21 M21 取得或設定這個 Matrix 結構之第二列第一行的值。Gets or sets the value of the second row and first column of this Matrix structure. M22 M22 M22 M22 取得或設定這個 Matrix 結構之第二列第二行的值。Gets or sets the value of the second row and second column of this Matrix structure. OffsetX OffsetX OffsetX OffsetX 取得或設定這個 Matrix 結構之第三列第一行的值。Gets or sets the value of the third row and first column of this Matrix structure. OffsetY OffsetY OffsetY OffsetY 取得或設定這個 Matrix 結構之第三列第二行的值。Gets or sets the value of the third row and second column of this Matrix structure.

## 方法

 Append(Matrix) Append(Matrix) Append(Matrix) Append(Matrix) 在這個 Matrix 結構之後加上指定的 Matrix 結構。Appends the specified Matrix structure to this Matrix structure. Equals(Object) Equals(Object) Equals(Object) Equals(Object) 判斷所指定 Object 的 Matrix 結構是否與這個 Matrix 相同。Determines whether the specified Object is a Matrix structure that is identical to this Matrix. Equals(Matrix) Equals(Matrix) Equals(Matrix) Equals(Matrix) 判斷指定的 Matrix 結構是否與這個執行個體相同。Determines whether the specified Matrix structure is identical to this instance. Equals(Matrix, Matrix) Equals(Matrix, Matrix) Equals(Matrix, Matrix) Equals(Matrix, Matrix) 判斷兩個指定的 Matrix 結構是否相同。Determines whether the two specified Matrix structures are identical. GetHashCode() GetHashCode() GetHashCode() GetHashCode() 傳回這個 Matrix 結構的雜湊程式碼。Returns the hash code for this Matrix structure. Invert() Invert() Invert() Invert() 反轉這個 Matrix 結構。Inverts this Matrix structure. Multiply(Matrix, Matrix) Multiply(Matrix, Matrix) Multiply(Matrix, Matrix) Multiply(Matrix, Matrix) 將 Matrix 結構乘以另一個 Matrix 結構。Multiplies a Matrix structure by another Matrix structure. Parse(String) Parse(String) Parse(String) Parse(String) 將矩陣的 String 表示轉換為對等的 Matrix 結構。Converts a String representation of a matrix into the equivalent Matrix structure. Prepend(Matrix) Prepend(Matrix) Prepend(Matrix) Prepend(Matrix) 在這個 Matrix 結構之前加上指定的 Matrix 結構。Prepends the specified Matrix structure onto this Matrix structure. Rotate(Double) Rotate(Double) Rotate(Double) Rotate(Double) 使這個 Matrix 結構繞著原點旋轉指定的角度。Applies a rotation of the specified angle about the origin of this Matrix structure. RotateAt(Double, Double, Double) RotateAt(Double, Double, Double) RotateAt(Double, Double, Double) RotateAt(Double, Double, Double) 繞著指定的點旋轉這個矩陣。Rotates this matrix about the specified point. RotateAtPrepend(Double, Double, Double) RotateAtPrepend(Double, Double, Double) RotateAtPrepend(Double, Double, Double) RotateAtPrepend(Double, Double, Double) 在這個 Matrix 結構之前加上繞著指定的點進行的所指定角度的旋轉。Prepends a rotation of the specified angle at the specified point to this Matrix structure. RotatePrepend(Double) RotatePrepend(Double) RotatePrepend(Double) RotatePrepend(Double) 在這個 Matrix 結構之前加上所指定角度的旋轉。Prepends a rotation of the specified angle to this Matrix structure. Scale(Double, Double) Scale(Double, Double) Scale(Double, Double) Scale(Double, Double) 在這個 Matrix 結構之前加上指定的縮放向量。Appends the specified scale vector to this Matrix structure. ScaleAt(Double, Double, Double, Double) ScaleAt(Double, Double, Double, Double) ScaleAt(Double, Double, Double, Double) ScaleAt(Double, Double, Double, Double) 以指定的點為中心，將這個 Matrix 縮放指定的量。Scales this Matrix by the specified amount about the specified point. ScaleAtPrepend(Double, Double, Double, Double) ScaleAtPrepend(Double, Double, Double, Double) ScaleAtPrepend(Double, Double, Double, Double) ScaleAtPrepend(Double, Double, Double, Double) 在這個 Matrix 前面加上以指定的點為中心的所指定縮放。Prepends the specified scale about the specified point of this Matrix. ScalePrepend(Double, Double) ScalePrepend(Double, Double) ScalePrepend(Double, Double) ScalePrepend(Double, Double) 在這個 Matrix 結構之前加上指定的縮放向量。Prepends the specified scale vector to this Matrix structure. SetIdentity() SetIdentity() SetIdentity() SetIdentity() 將這個 Matrix 結構變更為單位矩陣。Changes this Matrix structure into an identity matrix. Skew(Double, Double) Skew(Double, Double) Skew(Double, Double) Skew(Double, Double) 在這個 Matrix 結構之後加上指定的 X 和 Y 維度度數的扭曲。Appends a skew of the specified degrees in the x and y dimensions to this Matrix structure. SkewPrepend(Double, Double) SkewPrepend(Double, Double) SkewPrepend(Double, Double) SkewPrepend(Double, Double) 在這個 Matrix 結構之前加上指定的 X 和 Y 維度度數的扭曲。Prepends a skew of the specified degrees in the x and y dimensions to this Matrix structure. ToString() ToString() ToString() ToString() 建立這個 String 結構的 Matrix 表示。Creates a String representation of this Matrix structure. ToString(IFormatProvider) ToString(IFormatProvider) ToString(IFormatProvider) ToString(IFormatProvider) 使用文化特性特定格式資訊，建立這個 String 結構的 Matrix 表示。Creates a String representation of this Matrix structure with culture-specific formatting information. Transform(Point) Transform(Point) Transform(Point) Transform(Point) 依 Matrix 轉換指定的點，然後傳回結果。Transforms the specified point by the Matrix and returns the result. Transform(Point[]) Transform(Point[]) Transform(Point[]) Transform(Point[]) 依這個 Matrix 轉換指定的點。Transforms the specified points by this Matrix. Transform(Vector) Transform(Vector) Transform(Vector) Transform(Vector) 依這個 Matrix 轉換指定的向量。Transforms the specified vector by this Matrix. Transform(Vector[]) Transform(Vector[]) Transform(Vector[]) Transform(Vector[]) 依這個 Matrix 轉換指定的向量。Transforms the specified vectors by this Matrix. Translate(Double, Double) Translate(Double, Double) Translate(Double, Double) Translate(Double, Double) 在這個 Matrix 結構之後加上所指定位移的轉換。Appends a translation of the specified offsets to this Matrix structure. TranslatePrepend(Double, Double) TranslatePrepend(Double, Double) TranslatePrepend(Double, Double) TranslatePrepend(Double, Double) 在這個 Matrix 結構之前加上所指定位移的轉換。Prepends a translation of the specified offsets to this Matrix structure.

## 運算子

 Equality(Matrix, Matrix) Equality(Matrix, Matrix) Equality(Matrix, Matrix) Equality(Matrix, Matrix) 判斷兩個指定的 Matrix 結構是否相同。Determines whether the two specified Matrix structures are identical. Inequality(Matrix, Matrix) Inequality(Matrix, Matrix) Inequality(Matrix, Matrix) Inequality(Matrix, Matrix) 判斷兩個指定的 Matrix 結構是否不同。Determines whether the two specified Matrix structures are not identical. Multiply(Matrix, Matrix) Multiply(Matrix, Matrix) Multiply(Matrix, Matrix) Multiply(Matrix, Matrix) 將 Matrix 結構乘以另一個 Matrix 結構。Multiplies a Matrix structure by another Matrix structure.

## 明確介面實作

 IFormattable.ToString(String, IFormatProvider) IFormattable.ToString(String, IFormatProvider) IFormattable.ToString(String, IFormatProvider) IFormattable.ToString(String, IFormatProvider) 使用指定的格式，格式化目前執行個體的值。Formats the value of the current instance using the specified format.