Size Struct
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Implements a structure that is used to describe the Size of an object.
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
- Inheritance
- Attributes
- Implements
The following example demonstrates how to use a Size structure in code.
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 is particularly useful because it describes both the Height and Width of an object. Size is used extensively by the layout system to arrange and measure elements.
<object property="width,height"/>
width
A value greater than or equal to 0 that specifies the Width of the Size structure.
height
A value greater than or equal to 0 that specifies the Height of the Size structure.
Size(Double, Double) |
Initializes a new instance of the Size structure and assigns it an initial |
Empty |
Gets a value that represents a static empty Size. |
Height | |
Is |
Gets a value that indicates whether this instance of Size is Empty. |
Width |
Equals(Object) |
Compares an object to an instance of Size for equality. |
Equals(Size, Size) |
Compares two instances of Size for equality. |
Equals(Size) |
Compares a value to an instance of Size for equality. |
Get |
Gets the hash code for this instance of Size. |
Parse(String) | |
To |
|
To |
Equality(Size, Size) |
Compares two instances of Size for equality. |
Explicit(Size to Point) |
Explicitly converts an instance of Size to an instance of Point. |
Explicit(Size to Vector) |
Explicitly converts an instance of Size to an instance of Vector. |
Inequality(Size, Size) |
Compares two instances of Size for inequality. |
IFormattable. |
This type or member supports the Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code. |
제품 | 버전 |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
.NET 피드백
.NET은(는) 오픈 소스 프로젝트입니다. 다음 링크를 선택하여 피드백을 제공해 주세요.