# Point Struct

## 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.

Represents an x- and y-coordinate pair in two-dimensional space.

`public value class Point : IFormattable`

```
[System.ComponentModel.TypeConverter(typeof(System.Windows.PointConverter))]
public struct Point : IFormattable
```

```
[System.ComponentModel.TypeConverter(typeof(System.Windows.PointConverter))]
[System.Serializable]
public struct Point : IFormattable
```

```
[<System.ComponentModel.TypeConverter(typeof(System.Windows.PointConverter))>]
type Point = struct
interface IFormattable
```

```
[<System.ComponentModel.TypeConverter(typeof(System.Windows.PointConverter))>]
[<System.Serializable>]
type Point = struct
interface IFormattable
```

```
Public Structure Point
Implements IFormattable
```

- Inheritance

- Attributes

- Implements

## Examples

The following example shows how to check if two Point structures are not equal. It also illustrates how to assign values to a Point structure when the structure is being declared and after the structure has been declared.

```
// Checks if two Points are equal using the overloaded inequality operator.
private Boolean pointInequalityExample()
{
// Checks if two Points are not equal using the overloaded inequality operator.
// Declaring point1 and initializing x,y values
Point point1 = new Point(10, 5);
// Declaring point2 without initializing x,y values
Point point2 = new Point();
// Boolean to hold the result of the comparison
Boolean areNotEqual;
// assigning values to point2
point2.X = 15;
point2.Y = 40;
// Compare Point structures for equality.
// areNotEqual is True
areNotEqual = (point1 != point2);
return areNotEqual;
}
```

```
' Checks if two Points are equal using the overloaded inequality operator.
Private Function pointInequalityExample() As Boolean
' Checks if two Points are not equal using the overloaded inequality operator.
' Declaring point1 and initializing x,y values
Dim point1 As New Point(10, 5)
' Declaring point2 without initializing x,y values
Dim point2 As New Point()
' Boolean to hold the result of the comparison
Dim areNotEqual As Boolean
' assigning values to point2
point2.X = 15
point2.Y = 40
' Compare Point structures for equality.
' areNotEqual is True
areNotEqual = (point1 <> point2)
Return areNotEqual
End Function
```

## Remarks

In XAML, the delimiter between the X and Y values of a Point can be either a comma or a space.

Some cultures might use the comma character as the decimal delimiter instead of the period character. XAML processing for invariant culture defaults to en-US in most XAML processor implementations, and expects the period to be the decimal delimiter. You should avoid using the comma character as the decimal delimiter if specifying a Point in XAML, because that will clash with the string type conversion of a Point attribute value into the X and Y components.

### XAML Attribute Usage

```
<object property="x,y"/>
-or-
<object property="x y"/>
```

### XAML Values

*x*

The x-coordinate of this Point.

*y*

The y-coordinate of this Point.

## Constructors

Point(Double, Double) |
Creates a new Point structure that contains the specified coordinates. |

## Properties

X |
Gets or sets the X-coordinate value of this Point structure. |

Y |

## Methods

Add(Point, Vector) |
Adds a Vector to a Point and returns the result as a Point structure. |

Equals(Object) |
Determines whether the specified Object is a Point and whether it contains the same coordinates as this Point. |

Equals(Point) |
Compares two Point structures for equality. |

Equals(Point, Point) |
Compares two Point structures for equality. |

GetHashCode() |
Returns the hash code for this Point. |

Multiply(Point, Matrix) |
Transforms the specified Point structure by the specified Matrix structure. |

Offset(Double, Double) |
Offsets a point's X and Y coordinates by the specified amounts. |

Parse(String) | |

Subtract(Point, Point) |
Subtracts the specified Point from another specified Point and returns the difference as a Vector. |

Subtract(Point, Vector) |
Subtracts the specified Vector from the specified Point and returns the resulting Point. |

ToString() | |

ToString(IFormatProvider) |

## Operators

Addition(Point, Vector) |
Translates the specified Point by the specified Vector and returns the result. |

Equality(Point, Point) |
Compares two Point structures for equality. |

Explicit(Point to Size) |
Creates a Size structure with a Width equal to this point's X value and a Height equal to this point's Y value. |

Explicit(Point to Vector) |
Creates a Vector structure with an X value equal to the point's X value and a Y value equal to the point's Y value. |

Inequality(Point, Point) |
Compares two Point structures for inequality. |

Multiply(Point, Matrix) | |

Subtraction(Point, Point) |
Subtracts the specified Point from another specified Point and returns the difference as a Vector. |

Subtraction(Point, Vector) |
Subtracts the specified Vector from the specified Point and returns the resulting Point. |

## Explicit Interface Implementations

IFormattable.ToString(String, IFormatProvider) |
This member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code. For a description of this member, see ToString(String, IFormatProvider). |