Show / Hide Table of Contents

Struct Point

Represents an x- and y-coordinate pair in two-dimensional space. Can also represent a logical point for certain property usages.

Implements
System.IFormattable
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: System.Windows
Assembly: OpenSilver.dll
Syntax
public struct Point : IFormattable

Constructors

| Improve this Doc View Source

Point(Double, Double)

Initializes a Point structure that contains the specified values. contains the specified values.

Declaration
public Point(double x, double y)
Parameters
Type Name Description
System.Double x

The x-coordinate value of the Point structure.

System.Double y

The y-coordinate value of the Point structure.

Properties

| Improve this Doc View Source

X

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

Declaration
public double X { get; set; }
Property Value
Type Description
System.Double

The X-coordinate value of this Point structure. The default value is 0.

| Improve this Doc View Source

Y

Gets or sets the Y-coordinate value of this Point.

Declaration
public double Y { get; set; }
Property Value
Type Description
System.Double

The Y-coordinate value of this Point structure. The default value is 0.

Methods

| Improve this Doc View Source

Add(Point, Vector)

Adds a Vector to a Point and returns the result as a Point structure.

Declaration
public static Point Add(Point point, Vector vector)
Parameters
Type Name Description
Point point

The Point structure to add.

Vector vector

The Vector structure to add.

Returns
Type Description
Point

Returns the sum of point and vector.

| Improve this Doc View Source

Equals(Object)

Determines whether the specified object is a Point and whether it contains the same values as this Point.

Declaration
public override bool Equals(object o)
Parameters
Type Name Description
System.Object o

The object to compare.

Returns
Type Description
System.Boolean

true if obj is a Point and contains the same X and Y values as this Point; otherwise, false.

Overrides
System.ValueType.Equals(System.Object)
| Improve this Doc View Source

Equals(Point)

Compares two Point structures for equality.

Declaration
public bool Equals(Point value)
Parameters
Type Name Description
Point value

The point to compare to this instance.

Returns
Type Description
System.Boolean

true if both Point structures contain the same X and Y values; otherwise, false.

| Improve this Doc View Source

Equals(Point, Point)

Compares two Point structures for equality.

Declaration
public static bool Equals(Point point1, Point point2)
Parameters
Type Name Description
Point point1

The first point to compare.

Point point2

The second point to compare.

Returns
Type Description
System.Boolean

true if point1 and point2 contain the same X and Y values; otherwise, false.

| Improve this Doc View Source

GetHashCode()

Returns the hash code for this Point.

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

The hash code for this Point structure.

Overrides
System.ValueType.GetHashCode()
| Improve this Doc View Source

Multiply(Point, Matrix)

Transforms the specified Point structure by the specified Matrix structure.

Declaration
public static Point Multiply(Point point, Matrix matrix)
Parameters
Type Name Description
Point point

The point to transform.

Matrix matrix

The transformation matrix.

Returns
Type Description
Point

The transformed point.

| Improve this Doc View Source

Offset(Double, Double)

Offsets a point's X and Y coordinates by the specified amounts.

Declaration
public void Offset(double offsetX, double offsetY)
Parameters
Type Name Description
System.Double offsetX

The amount to offset the point's X coordinate.

System.Double offsetY

The amount to offset the point's Y coordinate.

| Improve this Doc View Source

Parse(String)

Constructs a Point from the specified System.String.

Declaration
public static Point Parse(string source)
Parameters
Type Name Description
System.String source

A string representation of a point.

Returns
Type Description
Point

The equivalent Point structure.

Exceptions
Type Condition
System.FormatException

source is not composed of two comma- or space-delimited double values.

| Improve this Doc View Source

Subtract(Point, Point)

Subtracts the specified Point from another specified Point and returns the difference as a Vector.

Declaration
public static Vector Subtract(Point point1, Point point2)
Parameters
Type Name Description
Point point1

The point from which point2 is subtracted.

Point point2

The point to subtract from point1.

Returns
Type Description
Vector

The difference between point1 and point2.

| Improve this Doc View Source

Subtract(Point, Vector)

Subtracts the specified Vector from the specified Point and returns the resulting Point.

Declaration
public static Point Subtract(Point point, Vector vector)
Parameters
Type Name Description
Point point
Vector vector

The vector to subtract from point.

Returns
Type Description
Point

The difference between point and vector.

| Improve this Doc View Source

ToString()

Creates a System.String representation of this Point.

Declaration
public override string ToString()
Returns
Type Description
System.String

A System.String containing the X and Y values of this Point structure.

Overrides
System.ValueType.ToString()
| Improve this Doc View Source

ToString(IFormatProvider)

Creates a System.String representation of this Point.

Declaration
public string ToString(IFormatProvider provider)
Parameters
Type Name Description
System.IFormatProvider provider

Culture-specific formatting information.

Returns
Type Description
System.String

A System.String containing the X and Y values of this Point structure.

Operators

| Improve this Doc View Source

Addition(Point, Vector)

Translates the specified Point by the specified Vector and returns the result.

Declaration
public static Point operator +(Point point, Vector vector)
Parameters
Type Name Description
Point point

The point to translate.

Vector vector

The amount by which to translate point.

Returns
Type Description
Point

The result of translating the specified point by the specified vector.

| Improve this Doc View Source

Equality(Point, Point)

Compares two Point structures for equality.

Declaration
public static bool operator ==(Point point1, Point point2)
Parameters
Type Name Description
Point point1

The first Point structure to compare.

Point point2

The second Point structure to compare.

Returns
Type Description
System.Boolean

true if both the X and Y values of point1 and point2 are equal; otherwise, false.

| Improve this Doc View Source

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.

Declaration
public static explicit operator Size(Point point)
Parameters
Type Name Description
Point point

The point to convert.

Returns
Type Description
Size

A Size structure with a Width equal to this point's X value and a Height equal to this point's Y value.

| Improve this Doc View Source

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.

Declaration
public static explicit operator Vector(Point point)
Parameters
Type Name Description
Point point

The point to convert.

Returns
Type Description
Vector

A vector with an X value equal to the point's X value and a Y value equal to the point's Y value.

| Improve this Doc View Source

Inequality(Point, Point)

Compares two Point structures for inequality

Declaration
public static bool operator !=(Point point1, Point point2)
Parameters
Type Name Description
Point point1

The first point to compare.

Point point2

The second point to compare.

Returns
Type Description
System.Boolean

true if point1 and point2 have different X or Y values; false if point1 and point2 have the same X and Y values.

| Improve this Doc View Source

Multiply(Point, Matrix)

Transforms the specified Point by the specified Matrix.

Declaration
public static Point operator *(Point point, Matrix matrix)
Parameters
Type Name Description
Point point

The point to transform.

Matrix matrix

The transformation matrix.

Returns
Type Description
Point

The result of transforming the specified point using the specified matrix.

| Improve this Doc View Source

Subtraction(Point, Point)

Subtracts the specified Point from another specified Point and returns the difference as a Vector.

Declaration
public static Vector operator -(Point point1, Point point2)
Parameters
Type Name Description
Point point1

The point from which point2 is subtracted.

Point point2

The point to subtract from point1.

Returns
Type Description
Vector

The difference between point1 and point2.

| Improve this Doc View Source

Subtraction(Point, Vector)

Subtracts the specified Vector from the specified Point and returns the resulting Point.

Declaration
public static Point operator -(Point point, Vector vector)
Parameters
Type Name Description
Point point

The point from which vector is subtracted.

Vector vector

The vector to subtract from point1.

Returns
Type Description
Point

The difference between point and vector.

Explicit Interface Implementations

| Improve this Doc View Source

IFormattable.ToString(String, IFormatProvider)

Creates a string representation of this object based on the format string and IFormatProvider passed in. If the provider is null, the CurrentCulture is used. See the documentation for IFormattable for more information.

Declaration
string IFormattable.ToString(string format, IFormatProvider provider)
Parameters
Type Name Description
System.String format
System.IFormatProvider provider
Returns
Type Description
System.String

A string representation of this object.

Implements

System.IFormattable
  • Improve this Doc
  • View Source