Point 結構

定義

``public value class Point : IEquatable<System::Drawing::Point>``
``````[System.ComponentModel.TypeConverter(typeof(System.Drawing.PointConverter))]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public struct Point : IEquatable<System.Drawing.Point>``````
``type Point = struct``
``````Public Structure Point
Implements IEquatable(Of Point)``````

範例

``````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 類別的新執行個體。Initializes a new instance of the Point class using coordinates specified by an integer value. 使用指定的座標，初始化 Point 類別的新執行個體。Initializes a new instance of the Point class with the specified coordinates. 從 Point 初始化 Size 類別的新執行個體。Initializes a new instance of the Point class from a Size.

欄位

 表示 Point，其 X 值與 Y 值設為零。Represents a Point that has X and Y values set to zero.

屬性

 取得值，指出這個 Point 是否為空的。Gets a value indicating whether this Point is empty. 取得或設定這個 Point 的 X 座標。Gets or sets the x-coordinate of this Point. 取得或設定這個 Point 的 Y 座標。Gets or sets the y-coordinate of this Point.

方法

 將指定的 Size 加上指定的 Point。Adds the specified Size to the specified Point. 藉由將 PointF 的值捨入為下一個較大的整數值，來將指定的 Point 轉換成 PointF。Converts the specified PointF to a Point by rounding the values of the PointF to the next higher integer values. 指定這個點執行個體是否包含與指定物件相同的座標。Specifies whether this point instance contains the same coordinates as the specified object. 指定這個點執行個體是否包含與其他點相同的座標。Specifies whether this point instance contains the same coordinates as another point. 傳回這個 Point 的雜湊碼。Returns a hash code for this Point. 根據指定的數量來平移這個 Point。Translates this Point by the specified amount. 根據指定的 Point 來轉換這個 Point。Translates this Point by the specified Point. 藉由將 PointF 值捨入為最接近的整數值，來將指定的 Point 轉換為 PointF 物件。Converts the specified PointF to a Point object by rounding the PointF values to the nearest integer. 傳回值，該值為從指定的 Size 減去指定的 Point 得到的結果。Returns the result of subtracting specified Size from the specified Point. 將這個 Point 轉換為人們可讀取的字串。Converts this Point to a human-readable string. 藉由截斷 PointF 的值，來將指定的 Point 轉換為 PointF。Converts the specified PointF to a Point by truncating the values of the PointF.

運算子

 根據指定的 Point 來轉換 Size。Translates a Point by a given Size. 比較兩個 Point 物件。Compares two Point objects. 結果會指定兩個 X 物件的 Y 和 Point 屬性值是否相等。The result specifies whether the values of the X and Y properties of the two Point objects are equal. 將指定的 Point 結構轉換成 Size 結構。Converts the specified Point structure to a Size structure. 將指定的 Point 結構轉換成 PointF 結構。Converts the specified Point structure to a PointF structure. 比較兩個 Point 物件。Compares two Point objects. 結果會指定兩個 X 物件的 Y 或 Point 屬性值是否不相等。The result specifies whether the values of the X or Y properties of the two Point objects are unequal. 根據指定 Point 的負數來轉換 Size。Translates a Point by the negative of a given Size.