Thickness Thickness Thickness Thickness Struct

定義

描述矩形周圍框架的粗細。Describes the thickness of a frame around a rectangle. 四個 Double 值分別描述矩形的 LeftTopRightBottom 邊。Four Double values describe the Left, Top, Right, and Bottom sides of the rectangle, respectively.

public value class Thickness : IEquatable<System::Windows::Thickness>
[System.ComponentModel.TypeConverter(typeof(System.Windows.ThicknessConverter))]
[System.Windows.Localizability(System.Windows.LocalizationCategory.None, Readability=System.Windows.Readability.Unreadable)]
public struct Thickness : IEquatable<System.Windows.Thickness>
type Thickness = struct
Public Structure Thickness
Implements IEquatable(Of Thickness)
繼承
屬性
實作

範例

下列範例示範如何建立的執行個體Thickness結構,並設定其屬性,使用Extensible Application Markup Language (XAML)Extensible Application Markup Language (XAML)和程式碼。The following example shows how to create an instance of a Thickness structure and set its properties by using Extensible Application Markup Language (XAML)Extensible Application Markup Language (XAML) and code.

myBorder2 = new Border();
myBorder2.BorderBrush = Brushes.SteelBlue;
myBorder2.Width = 400;
myBorder2.Height = 400;
myThickness = new Thickness();
myThickness.Bottom = 5;
myThickness.Left = 10;
myThickness.Right = 15;
myThickness.Top = 20;
myBorder2.BorderThickness = myThickness;
Dim myBorder2 As New Border()
myBorder2.BorderBrush = Brushes.SteelBlue
myBorder2.Width = 400
myBorder2.Height = 400
Dim myThickness As New Thickness()
myThickness.Bottom = 5
myThickness.Left = 10
myThickness.Right = 15
myThickness.Top = 20
myBorder2.BorderThickness = myThickness
<Border BorderBrush="SteelBlue" Width="400" Height="400" Canvas.Left="100" Canvas.Top="100">
  <Border.BorderThickness>
    10,20,15,5
  </Border.BorderThickness>
</Border>

備註

您可以指定Thickness兩種方式的值。You can specify Thickness values in two ways. 如果您傳遞四Double結構的值,它們代表LeftTopRightBottom邊,分別指定週框。If you pass four Double values to the structure, they represent the Left, Top, Right and Bottom sides, respectively, of the bounding rectangle. 您也可以提供統一的值套用至指定的週框四邊的單一值。You can also supply a single value, which applies a uniform value to all four sides of the bounding rectangle.

XAML Attribute UsageXAML Attribute Usage

<object property="left"/>  
- or -  
<object property="left,top"/>  
- or -  
<object property=" left,top,right,bottom" ... />  

XAML 值XAML Values

leftleft
框架中,為所述的左邊的緣Double值,指定裝置獨立單位 (每單位 1/96 英吋)device-independent units (1/96th inch per unit)量值,或是qualifiedDouble (如下所示)。The left edge of the frame, described as either a Double value that specifies a 裝置獨立單位 (每單位 1/96 英吋)device-independent units (1/96th inch per unit) measure, or as a qualifiedDouble (see below). 如果只指定單一量值,量值會套用到所有的左側、 頂端、 右側、 下方的值ThicknessIf only a single measure is specified, that measure is applied to ALL of the left,top,right,bottom values of a Thickness. 如果只指定一組左側、 頂端的量值,這些量值會套用至數採對稱式Thickness: 權限使用左的值; 在最高值使用於下方。If only a pair of left,top measures are specified, these measures are applied symmetrically to a Thickness: the left value is used for right; the top value is used for bottom.

toptop
上邊緣的框架中,為所述Double值,指定裝置獨立單位 (每單位 1/96 英吋)device-independent units (1/96th inch per unit)量值,或是qualifiedDouble (如下所示)。The top edge of the frame, described as either a Double value that specifies a 裝置獨立單位 (每單位 1/96 英吋)device-independent units (1/96th inch per unit) measure, or as a qualifiedDouble (see below). 如果只指定一組左側、 頂端的量值,這些量值會套用至數採對稱式Thickness: 權限使用左的值; 在最高值使用於下方。If only a pair of left,top measures are specified, these measures are applied symmetrically to a Thickness: the left value is used for right; the top value is used for bottom.

rightright
右邊框架中,為所述Double值,指定裝置獨立單位 (每單位 1/96 英吋)device-independent units (1/96th inch per unit)量值,或是qualifiedDouble (如下所示)。The right edge of the frame, described as either a Double value that specifies a 裝置獨立單位 (每單位 1/96 英吋)device-independent units (1/96th inch per unit) measure, or as a qualifiedDouble (see below). 如果沒有指定,會使用左的值。If left unspecified, will use the left value.

bottombottom
下邊緣的框架中,為所述Double值,指定裝置獨立單位 (每單位 1/96 英吋)device-independent units (1/96th inch per unit)量值,或是qualifiedDouble (如下所示)。The bottom edge of the frame, described as either a Double value that specifies a 裝置獨立單位 (每單位 1/96 英吋)device-independent units (1/96th inch per unit) measure, or as a qualifiedDouble (see below). 如果沒有指定,會使用左的值。If left unspecified, will use the left value.

qualifiedDoublequalifiedDouble
A值,如上面所述的任何量值,後面接著一個的下列單位宣告字串: pxincmptA double value as described above for any of the measures, followed by one of the following unit declaration strings: px, in, cm, pt.

px (預設值) 裝置獨立單位 (每單位 1/96 英吋)device-independent units (1/96th inch per unit)px (default) is 裝置獨立單位 (每單位 1/96 英吋)device-independent units (1/96th inch per unit)

in 是英吋為單位;1in = = 96pxin is inches; 1in==96px

cm 是公釐。1cm==(96/2.54) 像素cm is centimeters; 1cm==(96/2.54) px

pt is points; 1pt==(96/72) pxpt is points; 1pt==(96/72) px

注意

值不需要包含指定為字串時,明確的小數點。Values need not include the decimal point explicitly when specified as a string. 字串"1"中提供XAMLXAML評估為 1.0,當程式碼中參考的值。The string "1" provided in XAMLXAML evaluates to a value of 1.0 when referenced in code.

建構函式

Thickness(Double) Thickness(Double) Thickness(Double) Thickness(Double)

初始化 Thickness 結構的新執行個體,這個執行個體在每邊都統一指定長度。Initializes a new instance of the Thickness structure that has the specified uniform length on each side.

Thickness(Double, Double, Double, Double) Thickness(Double, Double, Double, Double) Thickness(Double, Double, Double, Double) Thickness(Double, Double, Double, Double)

初始化 Thickness 結構的新執行個體,此結構在矩形的每個邊都套用了特定的長度 (以 Double 形式提供)。Initializes a new instance of the Thickness structure that has specific lengths (supplied as a Double) applied to each side of the rectangle.

屬性

Bottom Bottom Bottom Bottom

取得或設定週框下邊的寬度 (以像素為單位)。Gets or sets the width, in pixels, of the lower side of the bounding rectangle.

Left Left Left Left

取得或設定週框左邊的寬度 (以像素為單位)。Gets or sets the width, in pixels, of the left side of the bounding rectangle.

Right Right Right Right

取得或設定週框右邊的寬度 (以像素為單位)。Gets or sets the width, in pixels, of the right side of the bounding rectangle.

Top Top Top Top

取得或設定週框上邊的寬度 (以像素為單位)。Gets or sets the width, in pixels, of the upper side of the bounding rectangle.

方法

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

比較這個 Thickness 結構與其他 Object 是否相等。Compares this Thickness structure to another Object for equality.

Equals(Thickness) Equals(Thickness) Equals(Thickness) Equals(Thickness)

比較這個 Thickness 結構與另一個 Thickness 結構是否相等。Compares this Thickness structure to another Thickness structure for equality.

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

傳回結構的雜湊碼。Returns the hash code of the structure.

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

傳回 Thickness 結構的字串表示。Returns the string representation of the Thickness structure.

運算子

Equality(Thickness, Thickness) Equality(Thickness, Thickness) Equality(Thickness, Thickness) Equality(Thickness, Thickness)

比較兩個 Thickness 結構的值是否相等。Compares the value of two Thickness structures for equality.

Inequality(Thickness, Thickness) Inequality(Thickness, Thickness) Inequality(Thickness, Thickness) Inequality(Thickness, Thickness)

比較兩個 Thickness 結構是否相等。Compares two Thickness structures for inequality.

適用於

另請參閱