Size Size Size Size Struct

定義

儲存一對已排序的整數,指定 HeightWidthStores an ordered pair of integers, which specify a Height and Width.

public value class Size : IEquatable<System::Drawing::Size>
[System.ComponentModel.TypeConverter(typeof(System.Drawing.SizeConverter))]
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public struct Size : IEquatable<System.Drawing.Size>
type Size = struct
Public Structure Size
Implements IEquatable(Of Size)
繼承
屬性
實作

備註

Size類別用來指定其高度和寬度,透過Size屬性RectangleRectangleFImageIcon和其他圖形類別。The Size class is used to specify a height and width through the Size property for Rectangle, RectangleF, Image, Icon and other graphics classes. 您可以在執行作業Size使用多載的運算子,例如AdditionSubtraction,和EqualityYou can perform operations on a Size by using the overloaded operators such as Addition, Subtraction, and Equality. 單位HeightWidthSize結構取決於PageUnitPageScale設定Graphics會用來繪製的物件。The unit for the Height and Width of the Size structure depend on the PageUnit and PageScale settings for the Graphics object that is used to draw.

建構函式

Size(Point) Size(Point) Size(Point) Size(Point)

從指定的 Size 結構,初始化 Point 結構的新執行個體。Initializes a new instance of the Size structure from the specified Point structure.

Size(Int32, Int32) Size(Int32, Int32) Size(Int32, Int32) Size(Int32, Int32)

從指定的維度,初始化 Size 結構的新執行個體。Initializes a new instance of the Size structure from the specified dimensions.

欄位

Empty Empty Empty Empty

取得 SizeHeight 值為 0 的 Width 結構。Gets a Size structure that has a Height and Width value of 0.

屬性

Height Height Height Height

取得或設定這個 Size 結構的垂直元件。Gets or sets the vertical component of this Size structure.

IsEmpty IsEmpty IsEmpty IsEmpty

測試這個 Size 結構的寬度和高度是否為零。Tests whether this Size structure has width and height of 0.

Width Width Width Width

取得或設定這個 Size 結構的水平元件。Gets or sets the horizontal component of this Size structure.

方法

Add(Size, Size) Add(Size, Size) Add(Size, Size) Add(Size, Size)

將一個 Size 結構的寬度和高度加上另一個 Size 結構的寬度和高度。Adds the width and height of one Size structure to the width and height of another Size structure.

Ceiling(SizeF) Ceiling(SizeF) Ceiling(SizeF) Ceiling(SizeF)

藉由將 SizeF 結構的值捨入為下一個較大的整數值,來將指定的 Size 結構轉換成 Size 結構。Converts the specified SizeF structure to a Size structure by rounding the values of the Size structure to the next higher integer values.

Equals(Size) Equals(Size) Equals(Size) Equals(Size)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

測試指定的物件是否為和此 Size 結構具有相同維度的 Size 結構。Tests to see whether the specified object is a Size structure with the same dimensions as this Size structure.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

傳回這個 Size 結構的雜湊程式碼。Returns a hash code for this Size structure.

Round(SizeF) Round(SizeF) Round(SizeF) Round(SizeF)

藉由將 SizeF 結構的值捨入為最接近的整數值,來將指定的 Size 結構轉換為 SizeF 結構。Converts the specified SizeF structure to a Size structure by rounding the values of the SizeF structure to the nearest integer values.

Subtract(Size, Size) Subtract(Size, Size) Subtract(Size, Size) Subtract(Size, Size)

將另一個 Size 結構的寬度和高度減去某一個 Size 結構的寬度和高度。Subtracts the width and height of one Size structure from the width and height of another Size structure.

ToString() ToString() ToString() ToString()

建立表示這個 Size 結構之人類看得懂的字串。Creates a human-readable string that represents this Size structure.

Truncate(SizeF) Truncate(SizeF) Truncate(SizeF) Truncate(SizeF)

藉由將 SizeF 結構的值截斷為下一個較小的整數值,來將指定的 Size 結構轉換為 SizeF 結構。Converts the specified SizeF structure to a Size structure by truncating the values of the SizeF structure to the next lower integer values.

運算子

Addition(Size, Size) Addition(Size, Size) Addition(Size, Size) Addition(Size, Size)

將一個 Size 結構的寬度和高度加上另一個 Size 結構的寬度和高度。Adds the width and height of one Size structure to the width and height of another Size structure.

Division(Size, Int32) Division(Size, Int32) Division(Size, Int32) Division(Size, Int32)
Division(Size, Single) Division(Size, Single) Division(Size, Single) Division(Size, Single)
Equality(Size, Size) Equality(Size, Size) Equality(Size, Size) Equality(Size, Size)

測試兩個 Size 結構是否相等。Tests whether two Size structures are equal.

Explicit(Size to Point) Explicit(Size to Point) Explicit(Size to Point) Explicit(Size to Point)

將指定的 Size 結構轉換成 Point 結構。Converts the specified Size structure to a Point structure.

Implicit(Size to SizeF) Implicit(Size to SizeF) Implicit(Size to SizeF) Implicit(Size to SizeF)

將指定的 Size 結構轉換成 SizeF 結構。Converts the specified Size structure to a SizeF structure.

Inequality(Size, Size) Inequality(Size, Size) Inequality(Size, Size) Inequality(Size, Size)

測試兩個 Size 結構是否不同。Tests whether two Size structures are different.

Multiply(Size, Int32) Multiply(Size, Int32) Multiply(Size, Int32) Multiply(Size, Int32)
Multiply(Size, Single) Multiply(Size, Single) Multiply(Size, Single) Multiply(Size, Single)
Multiply(Int32, Size) Multiply(Int32, Size) Multiply(Int32, Size) Multiply(Int32, Size)
Multiply(Single, Size) Multiply(Single, Size) Multiply(Single, Size) Multiply(Single, Size)
Subtraction(Size, Size) Subtraction(Size, Size) Subtraction(Size, Size) Subtraction(Size, Size)

將另一個 Size 結構的寬度和高度減去某一個 Size 結構的寬度和高度。Subtracts the width and height of one Size structure from the width and height of another Size structure.

適用於