Size3D 结构

定义

用于描述三维对象的大小的数据结构。Data structure that describes the size of a three-dimensional object.

public value class Size3D : IFormattable
[System.ComponentModel.TypeConverter(typeof(System.Windows.Media.Media3D.Size3DConverter))]
public struct Size3D : IFormattable
[System.ComponentModel.TypeConverter(typeof(System.Windows.Media.Media3D.Size3DConverter))]
[System.Serializable]
public struct Size3D : IFormattable
type Size3D = struct
    interface IFormattable
Public Structure Size3D
Implements IFormattable
继承
Size3D
属性
实现

示例

此示例演示如何使用 Size3D 静态 Equals 方法来确定两个 Size3D 的结构是否相等。This example shows how to determine if two Size3D structures are equal using the Size3D static Equals method.

下面的代码演示如何检查 Size3D 结构是否相等。The following code illustrates how to check Size3D structures for equality. Size3D 结构已声明并赋予值。The Size3D structures are declared and assigned values. 然后,使用 Equals 方法来确定两个结构是否相等。The Equals method is then used to determine if the two structures are equal.

private bool size3DEqualityExample()
{

    // 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();

    // Delcaring 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
    return areEqual;
}

注解

Size3DRect3D 通常不在 XAML 中使用,因为 WPF 3D 对象模型中不存在使用这些类型的可设置属性。Size3D and Rect3D are not typically used in XAML, because no settable properties exist in the WPF 3D object model that use those types.

构造函数

Size3D(Double, Double, Double)

初始化 Size3D 结构的新实例。Initializes a new instance of the Size3D structure.

属性

Empty

获取表示空的 Size3D 结构的值。Gets a value that represents an empty Size3D structure.

IsEmpty

获取指示此 Size3D 结构是否为空的值。Gets a value that indicates whether this Size3D structure is empty.

X

获取或设置此 X 结构的 Size3D 值。Gets or sets the X value of this Size3D structure.

Y

获取或设置此 Y 结构的 Size3D 值。Gets or sets the Y value of this Size3D structure.

Z

获取或设置此 Z 结构的 Size3D 值。Gets or sets the Z value of this Size3D structure.

方法

Equals(Object)

确定指定的对象是否为 Size3D 结构,以及指定的 ObjectXYZ 属性是否与此 Size3D 结构的 XYZ 属性相等。Determines whether the specified object is a Size3D structure and whether the X, Y and Z properties of the specified Object are equal to the X, Y and Z properties of this Size3D structure.

Equals(Size3D)

比较两个 Size3D 结构是否相等。Compares two Size3D structures for equality.

Equals(Size3D, Size3D)

比较两个 Size3D 结构是否相等。Compares two Size3D structures for equality. 如果两个 Size3D 结构的 XYZ 属性的值相同,则两个结构相等。Two Size3D structures are equal if the values of their X, Y, and Z properties are the same.

GetHashCode()

返回此 Size3D 结构的哈希代码。Returns a hash code for this Size3D structure.

Parse(String)

将三维大小结构的 String 表示形式转换为等效的 Size3D 结构。Converts a String representation of a three-dimensional size structure into the equivalent Size3D structure.

ToString()

创建此 String 结构的 Size3D 表示形式。Creates a String representation of this Size3D structure.

ToString(IFormatProvider)

创建此 String 结构的 Size3D 表示形式。Creates a String representation of this Size3D structure.

运算符

Equality(Size3D, Size3D)

比较两个 Size3D 结构是否相等。Compares two Size3D structures for equality. 如果两个 Size3D 结构的 XYZ 属性的值相同,则两个结构相等。Two Size3D structures are equal if the values of their X, Y, and Z properties are the same.

Explicit(Size3D to Point3D)

将此 Size3D 结构转换为 Point3D 结构。Converts this Size3D structure into a Point3D structure.

Explicit(Size3D to Vector3D)

将此 Size3D 结构转换为 Vector3D 结构。Converts this Size3D structure into a Vector3D structure.

Inequality(Size3D, Size3D)

比较两个 Size3D 结构是否不相等。Compares two Size3D structures for inequality. 如果两个 Size3D 结构的 XYZ 属性的值不同,则两个结构不相等。Two Size3D structures are not equal if the values of their X, Y and Z properties are different.

显式接口实现

IFormattable.ToString(String, IFormatProvider)

此成员支持 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 基础结构,但不能在代码中直接使用。This member supports the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code. 有关此成员的说明,请参见 ToString(String, IFormatProvider)For a description of this member, see ToString(String, IFormatProvider).

适用于