C# Класс 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.

Наследование: System.Drawing.Dimension2D
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
height int
width int

Открытые методы

Метод Описание
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.

Описание методов

Dimension() публичный Метод

Creates an instance of Dimension with a width of zero and a height of zero.
public Dimension ( ) : System
Результат System

Dimension() публичный Метод

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. ///
Результат System

Dimension() публичный Метод

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
Результат System

Equals() публичный Метод

Checks whether two dimension objects have equal values.
public Equals ( Object obj ) : bool
obj Object
Результат bool

GetHashCode() публичный Метод

Returns the hash code for this Dimension.
public GetHashCode ( ) : int
Результат int

SetSize() публичный Метод

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
Результат void

SetSize() публичный Метод

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.
Результат void

ToString() публичный Метод

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
Результат string

Описание свойств

height публичное свойство

The height dimension. Negative values can be used.
public int height
Результат int

width публичное свойство

The width dimension. Negative values can be used.
public int width
Результат int