Point 構造体
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
2 次元平面内の点を定義する、x 座標と y 座標の順序付けされたペアを表します。
public value class Point : IEquatable<System::Drawing::Point>
public value class Point
[System.ComponentModel.TypeConverter("System.Drawing.PointConverter, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public struct Point : IEquatable<System.Drawing.Point>
public struct Point
public struct Point : IEquatable<System.Drawing.Point>
[System.ComponentModel.TypeConverter(typeof(System.Drawing.PointConverter))]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public struct Point
[<System.ComponentModel.TypeConverter("System.Drawing.PointConverter, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]
type Point = struct
type Point = struct
[<System.ComponentModel.TypeConverter(typeof(System.Drawing.PointConverter))>]
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type Point = struct
Public Structure Point
Implements IEquatable(Of Point)
Public Structure Point
- 継承
- 属性
- 実装
例
次のコード例では、これらの型に対して定義されているオーバーロードされた演算子をいくつか使用して、ポイントとサイズを作成します。 また、 SystemPens クラスの使用方法についても説明します。
この例は、Windows フォームで使用するように設計されています。
Buttonという名前のsubtractButtonを含むフォームを作成します。 コードをフォームに貼り付け、フォームの CreatePointsAndSizes イベント処理メソッドから Paint メソッドを呼び出し、eとしてPaintEventArgs渡します。
void CreatePointsAndSizes( PaintEventArgs^ e )
{
// Create the starting point.
Point startPoint = Point(subtractButton->Size);
// Use the addition operator to get the end point.
Point endPoint = startPoint + System::Drawing::Size( 140, 150 );
// Draw a line between the points.
e->Graphics->DrawLine( SystemPens::Highlight, startPoint, endPoint );
// Convert the starting point to a size and compare it to the
// subtractButton size.
System::Drawing::Size buttonSize = (System::Drawing::Size)startPoint;
if ( buttonSize == subtractButton->Size )
{
e->Graphics->DrawString( "The sizes are equal.", gcnew System::Drawing::Font( this->Font,FontStyle::Italic ), Brushes::Indigo, 10.0F, 65.0F );
}
}
private void CreatePointsAndSizes(PaintEventArgs e)
{
// Create the starting point.
Point startPoint = new Point(subtractButton.Size);
// Use the addition operator to get the end point.
Point endPoint = startPoint + new Size(140, 150);
// Draw a line between the points.
e.Graphics.DrawLine(SystemPens.Highlight, startPoint, endPoint);
// Convert the starting point to a size and compare it to the
// subtractButton size.
Size buttonSize = (Size)startPoint;
if (buttonSize == subtractButton.Size)
// If the sizes are equal, tell the user.
{
e.Graphics.DrawString("The sizes are equal.",
new Font(this.Font, FontStyle.Italic),
Brushes.Indigo, 10.0F, 65.0F);
}
}
Private Sub CreatePointsAndSizes(ByVal e As PaintEventArgs)
' Create the starting point.
Dim startPoint As New Point(subtractButton.Size)
' Use the addition operator to get the end point.
Dim endPoint As Point = Point.op_Addition(startPoint, _
New Size(140, 150))
' Draw a line between the points.
e.Graphics.DrawLine(SystemPens.Highlight, startPoint, endPoint)
' Convert the starting point to a size and compare it to the
' subtractButton size.
Dim buttonSize As Size = Point.op_Explicit(startPoint)
If (Size.op_Equality(buttonSize, subtractButton.Size)) Then
' If the sizes are equal, tell the user.
e.Graphics.DrawString("The sizes are equal.", _
New Font(Me.Font, FontStyle.Italic), _
Brushes.Indigo, 10.0F, 65.0F)
End If
End Sub
注釈
PointをPointFに変換するには、Implicitを使用します。
コンストラクター
| 名前 | 説明 |
|---|---|
| Point(Int32, Int32) |
指定した座標を使用して、 Point 構造体の新しいインスタンスを初期化します。 |
| Point(Int32) |
整数値で指定された座標を使用して、 Point 構造体の新しいインスタンスを初期化します。 |
| Point(Size) |
フィールド
| 名前 | 説明 |
|---|---|
| Empty |
プロパティ
| 名前 | 説明 |
|---|---|
| IsEmpty |
この Point が空かどうかを示す値を取得します。 |
| X |
この Pointの x 座標を取得または設定します。 |
| Y |
この Pointの y 座標を取得または設定します。 |
メソッド
| 名前 | 説明 |
|---|---|
| Add(Point, Size) | |
| Ceiling(PointF) | |
| Equals(Object) |
このポイント インスタンスに、指定したオブジェクトと同じ座標が含まれているかどうかを指定します。 |
| Equals(Point) |
このポイント インスタンスに別の点と同じ座標が含まれているかどうかを指定します。 |
| GetHashCode() |
この Pointのハッシュ コードを返します。 |
| Offset(Int32, Int32) |
この Point を指定した量で変換します。 |
| Offset(Point) | |
| Round(PointF) | |
| Subtract(Point, Size) | |
| ToString() |
この Point を人間が判読できる文字列に変換します。 |
| Truncate(PointF) |
演算子
| 名前 | 説明 |
|---|---|
| Addition(Point, Size) | |
| Equality(Point, Point) |
2 つの Point オブジェクトを比較します。 結果は、2 つのX オブジェクトのYプロパティとPointプロパティの値が等しいかどうかを指定します。 |
| Explicit(Point to Size) | |
| Implicit(Point to PointF) | |
| Inequality(Point, Point) |
2 つの Point オブジェクトを比較します。 結果は、2 つのX オブジェクトのYプロパティまたはPointプロパティの値が等しくないかどうかを指定します。 |
| Subtraction(Point, Size) |