Size 構造体

定義

Size オブジェクトの記述に使用される構造体を実装します。

public value class Size : IFormattable
[System.ComponentModel.TypeConverter(typeof(System.Windows.SizeConverter))]
[System.Serializable]
public struct Size : IFormattable
[System.ComponentModel.TypeConverter(typeof(System.Windows.SizeConverter))]
public struct Size : IFormattable
[<System.ComponentModel.TypeConverter(typeof(System.Windows.SizeConverter))>]
[<System.Serializable>]
type Size = struct
    interface IFormattable
[<System.ComponentModel.TypeConverter(typeof(System.Windows.SizeConverter))>]
type Size = struct
    interface IFormattable
Public Structure Size
Implements IFormattable
継承
属性
実装

次の例では、コードで構造体を使用する方法を Size 示します。

virtual Size MeasureOverride(Size availableSize) override
{
    Size^ panelDesiredSize = gcnew Size();

    // In our example, we just have one child. 
    // Report that our panel requires just the size of its only child.
    for each (UIElement^ child in InternalChildren)
    {
        child->Measure(availableSize);
        panelDesiredSize = child->DesiredSize;
    }
    return *panelDesiredSize ;
}
protected override Size MeasureOverride(Size availableSize)
{
    Size panelDesiredSize = new Size();

    // In our example, we just have one child. 
    // Report that our panel requires just the size of its only child.
    foreach (UIElement child in InternalChildren)
    {
        child.Measure(availableSize);
        panelDesiredSize = child.DesiredSize;
    }

    return panelDesiredSize ;
}
Protected Overrides Function MeasureOverride(ByVal availableSize As System.Windows.Size) As System.Windows.Size
    Dim panelDesiredSize As Size = New Size()
    ' In our example, we just have one child. 
    ' Report that our panel requires just the size of its only child.
    For Each child As UIElement In InternalChildren
        child.Measure(availableSize)
        panelDesiredSize = child.DesiredSize
    Next
    Return panelDesiredSize
End Function

注釈

Sizeは、オブジェクトとWidthオブジェクトの両方Heightを記述するため、特に便利です。 Size は、要素を配置および測定するためにレイアウト システムによって広く使用されます。

XAML 属性の使用方法

<object property="width,height"/>  

XAML 値

width
構造体を指定 Width する 0 以上の Size 値。

height
構造体を指定 Height する 0 以上の Size 値。

コンストラクター

Size(Double, Double)

Size 構造体の新しいインスタンスを初期化し、width および height の初期値を割り当てます。

プロパティ

Empty

静的で空の Size を表す値を取得します。

Height

Height のこのインスタンスの Size を取得または設定します。

IsEmpty

Size のこのインスタンスが Empty かどうかを示す値を取得します。

Width

Width のこのインスタンスの Size を取得または設定します。

メソッド

Equals(Object)

オブジェクトが Size のインスタンスと等価であるかどうかを比較します。

Equals(Size)

値が Size のインスタンスと等しいかどうかを比較します。

Equals(Size, Size)

Size の 2 つのインスタンスを比較し、等しいかどうかを確認します。

GetHashCode()

Size のこのインスタンスのハッシュ コードを取得します。

Parse(String)

変換された Size から String のインスタンスを返します。

ToString()

この String オブジェクトを表す Size を返します。

ToString(IFormatProvider)

String のこのインスタンスを表す Size を返します。

演算子

Equality(Size, Size)

Size の 2 つのインスタンスを比較し、等しいかどうかを確認します。

Explicit(Size to Point)

Size のインスタンスを Point のインスタンスに明示的に変換します。

Explicit(Size to Vector)

Size のインスタンスを Vector のインスタンスに明示的に変換します。

Inequality(Size, Size)

Size の 2 つのインスタンスを比較し、等しくないかどうかを判断します。

明示的なインターフェイスの実装

IFormattable.ToString(String, IFormatProvider)

この型またはメンバーは、Windows Presentation Foundation (WPF) インフラストラクチャをサポートしますが、独自に作成したコードから直接使用するためのものではありません。

適用対象

こちらもご覧ください