In This Article

Padding Struct

Specifies a set of values for each side of a rectangle.

[TypeConverter(typeof(PaddingConverter))]
public struct Padding

Constructors

Padding(Sides, int)

Initializes a new instance of the Padding class.

public Padding(Sides sides, int value)
Parameter Type Description
sides Sides

The sides whose value will be initialized to the given value.

value int

The value to set for the given sides.

Padding(int)

Initializes a new instance of the Padding class.

public Padding(int allSides)
Parameter Type Description
allSides int

The value to assign to all sides.

Padding(int, int, int, int)

Initializes a new instance of the Padding class.

public Padding(int left, int top, int right, int bottom)
Parameter Type Description
left int

The left value to set.

top int

The top value to set.

right int

The right value to set.

bottom int

The bottom value to set.

Properties

All

Gets or sets all values.

public int All { get; set; }

Property Value

int:

All values.

AllSidesEqual

Gets whether the padding is set.

[Browsable(false)]
public bool AllSidesEqual { get; }

Property Value

bool:

true if any member of the padding is set; otherwise, false.

Bottom

Gets or sets the bottom value.

public int Bottom { get; set; }

Property Value

int:

The bottom value.

Empty

Gets an empty Padding object.

public static Padding Empty { get; }

Property Value

Padding:

The empty Padding object that was created.

Horizontal

Gets the combined padding for the right and left values.

[Browsable(false)]
public int Horizontal { get; }

Property Value

int:

The combined padding for the right and left values.

IsEmpty

Gets whether the padding is set.

[Browsable(false)]
public bool IsEmpty { get; }

Property Value

bool:

true if any member of the padding is set; otherwise, false.

Left

Gets or sets the left value.

public int Left { get; set; }

Property Value

int:

The left value.

Right

Gets or sets the right value.

public int Right { get; set; }

Property Value

int:

The right value.

Top

Gets or sets the top value.

public int Top { get; set; }

Property Value

int:

The top value.

Vertical

Gets the combined padding for the top and bottom values.

[Browsable(false)]
public int Vertical { get; }

Property Value

int:

The combined padding for the top and bottom values.

Zero

Gets an Padding object with all sides equal to zero.

public static Padding Zero { get; }

Property Value

Padding:

The Padding object that was created.

Methods

Equals(object)

Determines whether the specified Object is equal to the current Object.

public override bool Equals(object obj)
Parameter Type Description
obj object

The Object to compare to the current Object.

Returns

bool:

true if the specified Object is equal to the current Object; otherwise, false.

GetHashCode()

Returns a hash code for this object.

public override int GetHashCode()

Returns

int:

An integer value that specifies a hash value for this object.

Operators

operator ==(Padding, Padding)

Compares two Padding objects. The result specifies whether the property values of the two Padding objects are equal.

public static bool operator ==(Padding left, Padding right)
Parameter Type Description
left Padding

A Padding to compare.

right Padding

A Padding to compare.

Returns

bool:

true if the property values of left and right are equal; otherwise, false.

operator !=(Padding, Padding)

Compares two Padding objects. The result specifies whether the property values of the two Padding objects are unequal.

public static bool operator !=(Padding left, Padding right)
Parameter Type Description
left Padding

A Padding to compare.

right Padding

A Padding to compare.

Returns

bool:

true if the property values of left and right are unequal; otherwise, false.

Inherited Members

Extension Methods