0 out of 2 rated this helpful - Rate this topic

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.

  Name Description
Public method Size(Point) Initializes a new instance of the Size structure from the specified Point structure.
Public method Size(Int32, Int32) Initializes a new instance of the Size structure from the specified dimensions.
Top
  Name Description
Public property Height Gets or sets the vertical component of this Size structure.
Public property IsEmpty Tests whether this Size structure has width and height of 0.
Public property Width Gets or sets the horizontal component of this Size structure.
Top
  Name Description
Public method Static member Add Adds the width and height of one Size structure to the width and height of another Size structure.
Public method Static member Ceiling Converts the specified SizeF structure to a Size structure by rounding the values of the Size structure to the next higher integer values.
Public method Equals Tests to see whether the specified object is a Size structure with the same dimensions as this Size structure. (Overrides ValueType.Equals(Object).)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Returns a hash code for this Size structure. (Overrides ValueType.GetHashCode().)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Static member Round Converts the specified SizeF structure to a Size structure by rounding the values of the SizeF structure to the nearest integer values.
Public method Static member Subtract Subtracts the width and height of one Size structure from the width and height of another Size structure.
Public method ToString Creates a human-readable string that represents this Size structure. (Overrides ValueType.ToString().)
Public method Static member Truncate Converts the specified SizeF structure to a Size structure by truncating the values of the SizeF structure to the next lower integer values.
Top
  Name Description
Public operator Static member Addition Adds the width and height of one Size structure to the width and height of another Size structure.
Public operator Static member Equality Tests whether two Size structures are equal.
Public operator Static member Explicit(Size to Point) Converts the specified Size structure to a Point structure.
Public operator Static member Implicit(Size to SizeF) Converts the specified Size structure to a SizeF structure.
Public operator Static member Inequality Tests whether two Size structures are different.
Public operator Static member Subtraction Subtracts the width and height of one Size structure from the width and height of another Size structure.
Top
  Name Description
Public field Static member Empty Gets 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(Size, Size), Subtraction(Size, Size), and Equality(Size, Size). 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, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ