Padding

References
[TypeConverter(PaddingConverterInternal)] public struct Padding : IEquatable<Padding>
Represents an amount of padding to apply to an object at the top, left, right, and bottom.

Constructors

Padding

#
public Padding(int all)
Initializes a new instance of the Padding class with the specified padding for all sides

Padding

#
public Padding(int horizontal, int vertical)
Initializes a new instance of the Padding class with the specified padding for horizontal and vertical sides
horizontal (int)Amount of padding to set the Left and Right sides
vertical (int)Amount of padding to set the Top and Bottom sides

Padding

#
public Padding(int left, int top, int right, int bottom)
Initializes a new instance of the Padding class
left (int)Amount of padding to apply to the left
top (int)Amount of padding to apply to the top
right (int)Amount of padding to apply to the right
bottom (int)Amount of padding to apply to the bottom

Fields

Empty

#
public static readonly Padding Empty
Gets an empty padding with zero for each side

Properties

Bottom

#
public int Bottom { get; set; }
Gets or sets the padding on the bottom

Horizontal

#
public int Horizontal { get; }
Gets the total horizontal padding, which is the sum of Left and Right.

IsZero

#
public bool IsZero { get; }
Gets a value indicating that all sides of the padding are zero

Size

#
public Size Size { get; }
Gets the padding as a size value with the Horizontal and Vertical values as the Size.Width and Size.Height, respectively.

Vertical

#
public int Vertical { get; }
Gets the total vertical padding, which is the sum of Top and Bottom

Methods

Ceiling

#
public static Padding Ceiling(PaddingF padding)
Converts a floating point padding to an integral padding by taking the ceiling of its components
padding (PaddingF)Padding to convert
A new instance of a Padding class with the ceiling of the specified padding

Equals

#
public override bool Equals(object obj)
Determines the equality between this instance and the specified object
obj (object)Object to compare to
True if obj is a Padding object and is equal to this instance, false if not
ValueType.Equals

Equals

#
public bool Equals(Padding other)
Determines equality between this instance and the specified padding
other (Padding)Other padding instance to compare with
True if the specified padding is equal to this instance, false if not

GetHashCode

#
public override int GetHashCode()
Gets the hash code for this Padding instance

Round

#
public static Padding Round(PaddingF padding)
Converts a floating point padding to an integral padding by rounding each of its components
padding (PaddingF)Padding to convert
A new instance of a Padding class with rounded components of the specified padding

ToString

#
public override string ToString()
Converts this object to a string

Truncate

#
public static Padding Truncate(PaddingF padding)
Converts a floating point padding to an integral padding by truncating each of its components
padding (PaddingF)Padding to convert
A new instance of a Padding class with truncated components of the specified padding

Operators

OperationResultDescription
Padding+PaddingPaddingAdds two padding values together
Padding==PaddingboolDetermines the equality of two padding objects
Padding!=PaddingboolDetermines the inequality of two padding objects
Padding-PaddingPaddingSubtracts a padding value from another value
-PaddingPaddingReturns a new Padding with negative left, top, right, and bottom values

Convertors

OperationResultDescription
explicitPaddingFPaddingConverts a floating precision padding to integral values by truncating them.
implicitintPaddingImplicitly converts a single integer to a padding with all sides of equal value.