Point 構造体
定義
2 次元空間における、x 座標と y 座標の組を表します。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
- 継承
- 属性
- 実装
例
次の例は、2つの Point 構造体が等しくないかどうかを確認する方法を示しています。The following example shows how to check if two Point structures are not equal. また、構造体が宣言されている Point とき、および構造体が宣言された後に、構造体に値を割り当てる方法についても説明します。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
注釈
XAML では、の値との値の間の区切り記号には、 X Y Point コンマまたはスペースを使用できます。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 処理は、ほとんどの XAML プロセッサ実装では en-us に既定で設定されており、ピリオドは小数点の区切り記号になります。XAML processing for invariant culture defaults to en-US in most XAML processor implementations, and expects the period to be the decimal delimiter. XAML でを指定する場合、小数点区切り文字としてコンマ文字を使用しないようにする必要があり Point ます。これは、 Point 属性値からコンポーネントおよびコンポーネントへの文字列型の変換と競合するため X Y です。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 属性の使用方法XAML Attribute Usage
<object property="x,y"/>
-or-
<object property="x y"/>
XAML 値XAML Values
xx
この Point の x 座標。The x-coordinate of this Point.
yy
この Point の y 座標。The y-coordinate of this Point.
コンストラクター
Point(Double, Double) |
指定した座標を含む新しい Point 構造体を作成します。Creates a new Point structure that contains the specified coordinates. |
プロパティ
X |
この X 構造体の Point 座標値を取得または設定します。Gets or sets the X-coordinate value of this Point structure. |
Y |
この Y の Point 座標値を取得または設定します。Gets or sets the Y-coordinate value of this Point. |
メソッド
Add(Point, Vector) |
Vector を Point に加算し、その結果を Point 構造体として返します。Adds a Vector to a Point and returns the result as a Point structure. |
Equals(Object) |
指定した Object が Point であり、この Point と同じ座標を含んでいるかどうかを判断します。Determines whether the specified Object is a Point and whether it contains the same coordinates as this Point. |
Equals(Point) |
2 つの Point 構造体を比較して、等しいかどうかを確認します。Compares two Point structures for equality. |
Equals(Point, Point) |
2 つの Point 構造体を比較して、等しいかどうかを確認します。Compares two Point structures for equality. |
GetHashCode() |
この Point のハッシュ コードを返します。Returns the hash code for this Point. |
Multiply(Point, Matrix) |
指定した Point 構造体を、指定した Matrix 構造体で変換します。Transforms the specified Point structure by the specified Matrix structure. |
Offset(Double, Double) |
ポイントの X 座標と Y 座標を、指定した量だけオフセットします。Offsets a point's X and Y coordinates by the specified amounts. |
Parse(String) |
指定した Point から String を構築します。Constructs a Point from the specified String. |
Subtract(Point, Point) |
指定した Point を、指定した別の Point から減算し、その差を Vector として返します。Subtracts the specified Point from another specified Point and returns the difference as a Vector. |
Subtract(Point, Vector) |
指定した Vector を指定した Point から減算し、結果の Point を返します。Subtracts the specified Vector from the specified Point and returns the resulting Point. |
ToString() |
この String の Point 表現を作成します。Creates a String representation of this Point. |
ToString(IFormatProvider) |
この String の Point 表現を作成します。Creates a String representation of this Point. |
演算子
Addition(Point, Vector) |
指定した Point を指定した Vector で変換し、その結果を返します。Translates the specified Point by the specified Vector and returns the result. |
Equality(Point, Point) |
2 つの Point 構造体を比較して、等しいかどうかを確認します。Compares two Point structures for equality. |
Explicit(Point to Size) |
このポイントの Size 値と等しい Width と、このポイントの X 値と等しい Height を持つ Y 構造体を作成します。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) |
ポイントの Vector 値と等しい X 値と、ポイントの X 値と等しい Y 値を持つ Y 構造体を作成します。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) |
2 つの Point 構造体を比較し、等しくないかどうかを確認します。Compares two Point structures for inequality. |
Multiply(Point, Matrix) |
指定した Point を指定した Matrix で変換します。Transforms the specified Point by the specified Matrix. |
Subtraction(Point, Point) |
指定した Point を、指定した別の Point から減算し、その差を Vector として返します。Subtracts the specified Point from another specified Point and returns the difference as a Vector. |
Subtraction(Point, Vector) |
指定した Vector を指定した Point から減算し、結果の Point を返します。Subtracts the specified Vector from the specified Point and returns the resulting Point. |
明示的なインターフェイスの実装
IFormattable.ToString(String, IFormatProvider) |
このメンバーは、Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) インフラストラクチャをサポートしますが、独自に作成したコードから直接使用するためのものではありません。This member supports the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code. このメンバーの詳細については、「ToString(String, IFormatProvider)」をご覧ください。For a description of this member, see ToString(String, IFormatProvider). |