共用方式為


Size3D.X 屬性

定義

取得或設定這個 X 結構的 Size3D 值。

public:
 property double X { double get(); void set(double value); };
public double X { get; set; }
member this.X : double with get, set
Public Property X As Double

屬性值

這個 X 結構的 Size3D 值。 預設值是 0

範例

下列範例示範如何檢查兩 Size3D 個結構是否相等。 它也會示範如何在宣告結構時,以及在宣告結構之後,將值指派給 Size3D 結構。

// Checks if two Size3D structures are equal using the static Equals method. 
// Returns a Boolean.

// Declaring Size3D structure without initializing x,y,z values
Size3D size1 = new Size3D();

// Declaring Size3D structure and initializing x,y,z values
Size3D size2 = new Size3D(5, 10, 15);
Boolean areEqual;

// Assigning values to size1
size1.X = 2;
size1.Y = 4;
size1.Z = 6;

// checking for equality
areEqual = Size3D.Equals(size1, size2); 

// areEqual is False

// Displaying Results
syntaxString = "areEqual = Size3D.Equals(size1, size2);";
resultType = "Boolean";
operationString = "Checking if two Size3D structures are equal";
ShowResults(areEqual.ToString(), syntaxString, resultType, operationString);
' Checks if two Size3D structures are equal using the static Equals method. 
' Returns a Boolean.

' Declaring Size3D structure without initializing x,y,z values
Dim size1 As New Size3D()

' Declaring Size3D structure and initializing x,y,z values
Dim size2 As New Size3D(5, 10, 15)
Dim areEqual As Boolean

' Assigning values to size1
size1.X = 2
size1.Y = 4
size1.Z = 6

' checking for equality
areEqual = Size3D.Equals(size1, size2)

' areEqual is False

' Displaying Results
syntaxString = "areEqual = Size3D.Equals(size1, size2)"
resultType = "Boolean"
operationString = "Checking if two Size3D structures are equal"
ShowResults(areEqual.ToString(), syntaxString, resultType, operationString)

備註

XYZ 值必須是非負值。

Size3DRect3D 通常不會用於 XAML,因為 WPF 3D 物件模型中沒有使用這些類型的可設定屬性。

適用於