Export (0) Print
Expand All

Size Structure

Stores an ordered pair of integers, which specify a Height and Width.

Namespace:  System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)

[SerializableAttribute]
[TypeConverterAttribute(typeof(SizeConverter))]
[ComVisibleAttribute(true)]
public struct Size

The Size type exposes the following members.

  NameDescription
Public methodSize(Point)Initializes a new instance of the Size structure from the specified Point structure.
Public methodSize(Int32, Int32)Initializes a new instance of the Size structure from the specified dimensions.
Top

  NameDescription
Public propertyHeightGets or sets the vertical component of this Size structure.
Public propertyIsEmptyTests whether this Size structure has width and height of 0.
Public propertyWidthGets or sets the horizontal component of this Size structure.
Top

  NameDescription
Public methodStatic memberAddAdds the width and height of one Size structure to the width and height of another Size structure.
Public methodStatic memberCeilingConverts the specified SizeF structure to a Size structure by rounding the values of the Size structure to the next higher integer values.
Public methodEqualsTests to see whether the specified object is a Size structure with the same dimensions as this Size structure. (Overrides ValueType.Equals(Object).)
Public methodGetHashCodeReturns a hash code for this Size structure. (Overrides ValueType.GetHashCode().)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodStatic memberRoundConverts the specified SizeF structure to a Size structure by rounding the values of the SizeF structure to the nearest integer values.
Public methodStatic memberSubtractSubtracts the width and height of one Size structure from the width and height of another Size structure.
Public methodToStringCreates a human-readable string that represents this Size structure. (Overrides ValueType.ToString().)
Public methodStatic memberTruncateConverts the specified SizeF structure to a Size structure by truncating the values of the SizeF structure to the next lower integer values.
Top

  NameDescription
Public operatorStatic memberAdditionAdds the width and height of one Size structure to the width and height of another Size structure.
Public operatorStatic memberEqualityTests whether two Size structures are equal.
Public operatorStatic memberExplicit(Size to Point)Converts the specified Size structure to a Point structure.
Public operatorStatic memberImplicit(Size to SizeF)Converts the specified Size structure to a SizeF structure.
Public operatorStatic memberInequalityTests whether two Size structures are different.
Public operatorStatic memberSubtractionSubtracts the width and height of one Size structure from the width and height of another Size structure.
Top

  NameDescription
Public fieldStatic memberEmptyGets a Size structure that has a Height and Width value of 0.
Top

The Size class is used to specify a height and width through the Size property for Rectangle, RectangleF, Image, Icon and other graphics classes. You can perform operations on a Size by using the overloaded operators such as Addition, Subtraction, and Equality. The unit for the Height and Width of the Size structure depend on the PageUnit and PageScale settings for the Graphics object that is used to draw.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft