Partager via


AbstractSize Struct

Definition

A class that represents size abstractly. This is useful with controls or panels that support multiple orientations. The rendering or layout code for the control or panel can be written using a single, "natural" orientation and then the size can be converted, if necessary, to the control's or panel's actual orientation as needed. This can substantially simplify rendering or layout logic.

public value class AbstractSize
struct AbstractSize
public struct AbstractSize
type AbstractSize = struct
Public Structure AbstractSize
Inheritance
AbstractSize

Constructors

AbstractSize(Orientation, Orientation, Double, Double)

Initializes a new instance of AbstractSize.

AbstractSize(Orientation, Orientation, Size)

Initializes a new instance of AbstractSize.

AbstractSize(Orientation, Orientation)

Initializes a new instance of AbstractSize.

Properties

AbstractHeight

The abstract height of the size.

AbstractWidth

The abstract width of the size.

ActualOrientation

The actual orientation of the geometric unit. This is typically determined by the value of the Orientation property of the control or panel in which this structure is used.

IsNatural

Indiates whether the size's actual orientation matches its natural orientation.

NaturalOrientation

The "natural" orientation of the geometric unit, from the perspective of the context in which it is used. For example, it may be most natural to write the layout code for a StackPanel using Vertical orientation since a stack in the real world is a vertical thing.

The choice of natural orientation within a given context is not important, as long as the same natural orientation is used consistently throughout that context.

RealHeight

The real, non-abstract height of the size. If IsNatural is true, the real height and the abstract height are the same. If IsNatural is false, the real height is the abstract width.

RealSize

The real, non-abstract size represented by this structure. If IsNatural is true, the real size and the abstract size are the same. If IsNatural is false, the real size is the inverse of the abstract size.

RealWidth

The real, non-abstract width of the size. If IsNatural is true, the real width and the abstract width are the same. If IsNatural is false, the real width is the abstract height.

Methods

Invert(Size)

Returns a Size structure with the input's Width and Height properties swapped.

ToString()

Creates a string representation of this abstract size

Applies to