Point 结构
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示二维空间中的 x 坐标和 y 坐标对。
public value class Point : IFormattable
[System.ComponentModel.TypeConverter(typeof(System.Windows.PointConverter))]
[System.Serializable]
public struct Point : IFormattable
[System.ComponentModel.TypeConverter(typeof(System.Windows.PointConverter))]
public struct Point : IFormattable
[<System.ComponentModel.TypeConverter(typeof(System.Windows.PointConverter))>]
[<System.Serializable>]
type Point = struct
interface IFormattable
[<System.ComponentModel.TypeConverter(typeof(System.Windows.PointConverter))>]
type Point = struct
interface IFormattable
Public Structure Point
Implements IFormattable
- 继承
- 属性
- 实现
示例
以下示例演示如何检查两 Point 个结构是否不相等。 它还说明了在声明结构时以及如何在声明结构之后向结构赋值 Point 。
// 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
注解
在 XAML 中XY,分隔符与值Point之间的分隔符可以是逗号或空格。
某些区域性可能会使用逗号字符作为小数分隔符,而不是句点字符。 固定区域性的 XAML 处理默认在大多数 XAML 处理器实现中 en-US,并且预期句点为小数分隔符。 如果在 XAML 中指定Point字符,则应避免使用逗号字符作为小数分隔符,因为这将与属性值的字符串类型转换Point和XY组件冲突。
XAML 属性用法
<object property="x,y"/>
-or-
<object property="x y"/>
XAML 值
x 此对象的 Pointx 坐标。
y 的 y 坐标 Point。
构造函数
| 名称 | 说明 |
|---|---|
| Point(Double, Double) |
创建包含指定坐标的新 Point 结构。 |
属性
| 名称 | 说明 |
|---|---|
| X | |
| Y |
方法
| 名称 | 说明 |
|---|---|
| Add(Point, Vector) | |
| Equals(Object) | |
| Equals(Point, Point) |
比较两 Point 个结构是否相等。 |
| Equals(Point) |
比较两 Point 个结构是否相等。 |
| GetHashCode() |
返回此 Point代码的哈希代码。 |
| Multiply(Point, Matrix) | |
| Offset(Double, Double) | |
| Parse(String) | |
| Subtract(Point, Point) | |
| Subtract(Point, Vector) | |
| ToString() | |
| ToString(IFormatProvider) |
运营商
显式接口实现
| 名称 | 说明 |
|---|---|
| IFormattable.ToString(String, IFormatProvider) |
此成员支持 Windows Presentation Foundation (WPF) 基础结构,不应直接从代码使用。 有关此成员的说明,请参阅 ToString(String, IFormatProvider)。 |