C# Class System.Drawing.Dimension

The Dimension class encapsulates the width and height of a component (in int precision) in a single object.
The class is associated with certain properties of components. Several methods defined by the Component class and the LayoutManager interface return a Dimension object.

Normally the values of width and height are non-negative ints. The constructors that allow you to create a dimension do not prevent you from setting a negative value for these properties. If the value of width or height is negative, the behavior of some methods defined by other objects is undefined.

Inheritance: System.Drawing.Dimension2D
Show file Open project: red-gate/iTextSharp-4.1.6 Class Usage Examples

Public Properties

Property Type Description
height int
width int

Public Methods

Method Description
Dimension ( ) : System

Creates an instance of Dimension with a width of zero and a height of zero.

Dimension ( Dimension d ) : System

Creates an instance of Dimension whose width and height are the same as for the specified dimension.

Dimension ( int width, int height ) : System

Constructs a Dimension and initializes it to the specified width and specified height.

Equals ( Object obj ) : bool

Checks whether two dimension objects have equal values.

GetHashCode ( ) : int

Returns the hash code for this Dimension.

SetSize ( double width, double height ) : void

Set the size of this Dimension object to the specified width and height in double precision.

SetSize ( int width, int height ) : void

Set the size of this Dimension object to the specified width and height.

ToString ( ) : string

Returns a string representation of the values of this Dimension object's height and width fields.

This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.

Method Details

Dimension() public method

Creates an instance of Dimension with a width of zero and a height of zero.
public Dimension ( ) : System
return System

Dimension() public method

Creates an instance of Dimension whose width and height are the same as for the specified dimension.
public Dimension ( Dimension d ) : System
d Dimension /// the specified dimension for the /// width and /// height values. ///
return System

Dimension() public method

Constructs a Dimension and initializes it to the specified width and specified height.
public Dimension ( int width, int height ) : System
width int the specified width dimension
height int the specified height dimension
return System

Equals() public method

Checks whether two dimension objects have equal values.
public Equals ( Object obj ) : bool
obj Object
return bool

GetHashCode() public method

Returns the hash code for this Dimension.
public GetHashCode ( ) : int
return int

SetSize() public method

Set the size of this Dimension object to the specified width and height in double precision.
public SetSize ( double width, double height ) : void
width double the new width for the Dimension object
height double the new height for the Dimension object
return void

SetSize() public method

Set the size of this Dimension object to the specified width and height.
public SetSize ( int width, int height ) : void
width int the new width for this Dimension object.
height int the new height for this Dimension object.
return void

ToString() public method

Returns a string representation of the values of this Dimension object's height and width fields.
This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.
public ToString ( ) : string
return string

Property Details

height public property

The height dimension. Negative values can be used.
public int height
return int

width public property

The width dimension. Negative values can be used.
public int width
return int