CVB.Net 14.0
Size2D Struct Reference

Stores an ordered pair of integers, typical the width and height of a Rect. More...

Public Member Functions

 Size2D (int width, int height)
 Creates a size with a given width and height . More...
 
 Size2D (Point2D pt)
 Creates a size from the given point's pt horizontal and vertical components. More...
 
override string ToString ()
 Gets the string representation of this size. More...
 
override bool Equals (object obj)
 Tests whether two objects are Size2D and equal. More...
 
override int GetHashCode ()
 Default implementation. More...
 

Static Public Member Functions

static Size2D Add (Size2D sz1, Size2D sz2)
 Adds the width and height of one Size2D structure width and height of another one. More...
 
static Size2D Subtract (Size2D sz1, Size2D sz2)
 Subtracts the width and height of one Size2D structure width and height of another one. More...
 
static operator Point2D (Size2D sz)
 Converts the given sz to a Point2D. More...
 
static Size2D operator+ (Size2D sz1, Size2D sz2)
 Adds the width and height of one Size2D structure width and height of another one. More...
 
static Size2D operator- (Size2D sz1, Size2D sz2)
 Subtracts the width and height of one Size2D structure width and height of another one. More...
 
static bool operator== (Size2D sz1, Size2D sz2)
 Tests whether two sizes are equal. More...
 
static bool operator!= (Size2D sz1, Size2D sz2)
 Tests whether two sizes are unequal. More...
 

Static Public Attributes

static readonly Size2D Empty = new Size2D()
 Gets a Size2D with Width and Height value of 0.
 

Properties

int Width [get, set]
 Gets/sets the horizontal component of the size.
 
int Height [get, set]
 Gets/sets the vertical component of the size.
 

Detailed Description

Stores an ordered pair of integers, typical the width and height of a Rect.

Constructor & Destructor Documentation

◆ Size2D() [1/2]

Size2D ( int  width,
int  height 
)

Creates a size with a given width and height .

Parameters
widthHorizontal component of the size.
heightVertical component of the size.

◆ Size2D() [2/2]

Size2D ( Point2D  pt)

Creates a size from the given point's pt horizontal and vertical components.

Parameters
ptPoint to initialize the size with.

Member Function Documentation

◆ Add()

static Size2D Add ( Size2D  sz1,
Size2D  sz2 
)
static

Adds the width and height of one Size2D structure width and height of another one.

Parameters
sz1First size to add.
sz2Second size to add.
Returns
Resulting SizeD from the addition operation.

◆ Equals()

override bool Equals ( object  obj)

Tests whether two objects are Size2D and equal.

Parameters
objObject to test.
Returns
true if they are exactly equal; false if not.

◆ GetHashCode()

override int GetHashCode ( )

Default implementation.

Returns
Default hash code.

◆ operator Point2D()

static operator Point2D ( Size2D  sz)
explicitstatic

Converts the given sz to a Point2D.

Parameters
szSize to convert.
Returns
New PointD.

◆ operator!=()

static bool operator!= ( Size2D  sz1,
Size2D  sz2 
)
static

Tests whether two sizes are unequal.

Parameters
sz1First size to test.
sz2Second size to test.
Returns
true if they are unequal; false if not.

◆ operator+()

static Size2D operator+ ( Size2D  sz1,
Size2D  sz2 
)
static

Adds the width and height of one Size2D structure width and height of another one.

Parameters
sz1First size to add.
sz2Second size to add.
Returns
Resulting SizeD from the addition operation.

◆ operator-()

static Size2D operator- ( Size2D  sz1,
Size2D  sz2 
)
static

Subtracts the width and height of one Size2D structure width and height of another one.

Parameters
sz1First size to subtract.
sz2Second size to subtract.
Returns
Resulting Size2D from the subtract operation.

◆ operator==()

static bool operator== ( Size2D  sz1,
Size2D  sz2 
)
static

Tests whether two sizes are equal.

Parameters
sz1First size to test.
sz2Second size to test.
Returns
true if they are exactly equal; false if not.

◆ Subtract()

static Size2D Subtract ( Size2D  sz1,
Size2D  sz2 
)
static

Subtracts the width and height of one Size2D structure width and height of another one.

Parameters
sz1First size to subtract.
sz2Second size to subtract.
Returns
Resulting SizeD from the subtract operation.

◆ ToString()

override string ToString ( )

Gets the string representation of this size.

Returns
String representation.