# Matrix Class

## Definition

Important

Some information relates to prerelease product that may be substantially modified before itâ€™s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Encapsulates a 3-by-3 affine matrix that represents a geometric transform. This class cannot be inherited.

`public ref class Matrix sealed : MarshalByRefObject, IDisposable`

`public sealed class Matrix : MarshalByRefObject, IDisposable`

```
type Matrix = class
inherit MarshalByRefObject
interface IDisposable
```

```
Public NotInheritable Class Matrix
Inherits MarshalByRefObject
Implements IDisposable
```

- Inheritance

- Implements

## Remarks

For more information about this API, see Supplemental API remarks for Matrix.

## Constructors

Matrix() |
Initializes a new instance of the Matrix class as the identity matrix. |

Matrix(Matrix3x2) |
Constructs a Matrix utilizing the specified |

Matrix(Rectangle, Point[]) |
Initializes a new instance of the Matrix class to the geometric transform defined by the specified rectangle and array of points. |

Matrix(RectangleF, PointF[]) |
Initializes a new instance of the Matrix class to the geometric transform defined by the specified rectangle and array of points. |

Matrix(Single, Single, Single, Single, Single, Single) |
Initializes a new instance of the Matrix class with the specified elements. |

## Properties

Elements |
Gets an array of floating-point values that represents the elements of this Matrix. |

IsIdentity |
Gets a value indicating whether this Matrix is the identity matrix. |

IsInvertible |
Gets a value indicating whether this Matrix is invertible. |

MatrixElements |
Gets or sets the elements for the matrix. |

OffsetX |
Gets the x translation value (the dx value, or the element in the third row and first column) of this Matrix. |

OffsetY |
Gets the y translation value (the dy value, or the element in the third row and second column) of this Matrix. |

## Methods

Clone() |
Creates an exact copy of this Matrix. |

CreateObjRef(Type) |
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject) |

Dispose() |
Releases all resources used by this Matrix. |

Equals(Object) |
Tests whether the specified object is a Matrix and is identical to this Matrix. |

Finalize() |
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. |

GetHashCode() |
Returns a hash code. |

GetLifetimeService() |
Obsolete.
Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject) |

GetType() |
Gets the Type of the current instance. (Inherited from Object) |

InitializeLifetimeService() |
Obsolete.
Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject) |

Invert() |
Inverts this Matrix, if it is invertible. |

MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |

MemberwiseClone(Boolean) |
Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject) |

Multiply(Matrix) |
Multiplies this Matrix by the matrix specified in the |

Multiply(Matrix, MatrixOrder) |
Multiplies this Matrix by the matrix specified in the |

Reset() |
Resets this Matrix to have the elements of the identity matrix. |

Rotate(Single) |
Prepend to this Matrix a clockwise rotation, around the origin and by the specified angle. |

Rotate(Single, MatrixOrder) |
Applies a clockwise rotation of an amount specified in the |

RotateAt(Single, PointF) |
Applies a clockwise rotation to this Matrix around the point specified in the |

RotateAt(Single, PointF, MatrixOrder) |
Applies a clockwise rotation about the specified point to this Matrix in the specified order. |

Scale(Single, Single) |
Applies the specified scale vector to this Matrix by prepending the scale vector. |

Scale(Single, Single, MatrixOrder) |
Applies the specified scale vector ( |

Shear(Single, Single) |
Applies the specified shear vector to this Matrix by prepending the shear transformation. |

Shear(Single, Single, MatrixOrder) |
Applies the specified shear vector to this Matrix in the specified order. |

ToString() |
Returns a string that represents the current object. (Inherited from Object) |

TransformPoints(Point[]) |
Applies the geometric transform represented by this Matrix to a specified array of points. |

TransformPoints(PointF[]) |
Applies the geometric transform represented by this Matrix to a specified array of points. |

TransformPoints(ReadOnlySpan<Point>) | |

TransformPoints(ReadOnlySpan<PointF>) | |

TransformVectors(Point[]) |
Applies only the scale and rotate components of this Matrix to the specified array of points. |

TransformVectors(PointF[]) |
Multiplies each vector in an array by the matrix. The translation elements of this matrix (third row) are ignored. |

TransformVectors(ReadOnlySpan<Point>) | |

TransformVectors(ReadOnlySpan<PointF>) | |

Translate(Single, Single) |
Applies the specified translation vector ( |

Translate(Single, Single, MatrixOrder) |
Applies the specified translation vector to this Matrix in the specified order. |

VectorTransformPoints(Point[]) |
Multiplies each vector in an array by the matrix. The translation elements of this matrix (third row) are ignored. |

VectorTransformPoints(ReadOnlySpan<Point>) |

## Applies to

## See also

## Feedback

https://aka.ms/ContentUserFeedback.

Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for