System.Windows Namespace


.NET Framework Class Library
Point Structure

Updated: December 2008

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

Namespace:  System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)
XMLNS for XAML: http://schemas.microsoft.com/winfx/2006/xaml/presentation, http://schemas.microsoft.com/netfx/2007/xaml/presentation
Syntax

Visual Basic (Declaration)
<SerializableAttribute> _
<TypeConverterAttribute(GetType(PointConverter))> _
Public Structure Point _
    Implements IFormattable
Visual Basic (Usage)
Dim instance As Point
C#
[SerializableAttribute]
[TypeConverterAttribute(typeof(PointConverter))]
public struct Point : IFormattable
Visual C++
[SerializableAttribute]
[TypeConverterAttribute(typeof(PointConverter))]
public value class Point : IFormattable
JScript
JScript supports the use of structures, but not the declaration of new ones.
XAML Object Element Usage
<Point .../>
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.

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.

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.

C#
// 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;

}

More Code

How to: Make an Object Follow the Mouse Pointer This example shows how to change the dimensions of an object when the mouse pointer moves on the screen.
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Platforms

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information

.NET Framework

Supported in: 3.5, 3.0
See Also

Reference

Change History

Date

History

Reason

December 2008

XAML authoring to account for dual delimiters and note possible locale issues with , as the delimiter.

Information enhancement.

Tags :


Community Content

adam.sida
Point problem with mapservers and gis applications

Hello,

I just wanted to share my trouble with Point struct. It is pretty useless for purpopse of drawing geometries from database BLOBs formated as OGC WKB or even other, such as new sqlserver Spatial data type.

Missing very much some IPoint interface instead of struct in Polygon, Polyline,.. objects

Problem with current implementation is, that you need to copy a lot of data between rowset field (image or spatial) and Point[] struct, which is time and memory consuming (especially for mapservers, drawing bitmaps only) and also anoying.

but this is just my opinion, may be there is some good reason to leave it as is....

Adam


Page view tracker