Padding Struct
Specifies a set of values for each side of a rectangle.
[TypeConverter(typeof(PaddingConverter))]
public struct Padding : IEquatable<Padding>
- Implements:
- IEquatable<Padding>
Constructors
Padding(Sides, int)
Initializes an instance of the structure.
public Padding(Sides sides, int value)
| Parameter | Type | Description |
|---|---|---|
| sides | Sides | The sides whose value will be initialized to the given |
| value | int | The value to set for the given |
Padding(int)
Initializes an instance of the structure.
public Padding(int allSides)
| Parameter | Type | Description |
|---|---|---|
| allSides | int | The value to assign to all sides. |
Padding(int, int, int, int)
Initializes an instance of the structure.
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
The value of all sides.
AllSidesEqual
Indicates whether all sides have the same value.
[Browsable(false)]
public readonly bool AllSidesEqual { get; }
Property Value
- bool:
trueif all sides have the same value; otherwise,false.
Bottom
The bottom value.
Empty
An empty Padding object.
Horizontal
The combined padding for the right and left values.
IsEmpty
Indicates whether the padding is set.
[Browsable(false)]
public readonly bool IsEmpty { get; }
Property Value
- bool:
trueif any member of the padding is set; otherwise,false.
Left
The left value.
Right
The right value.
Top
The top value.
Vertical
The combined padding for the top and bottom values.
Zero
A Padding object with all sides equal to zero.
Methods
Equals(Padding)
Indicates whether the current object is equal to another object of the same type.
public readonly bool Equals(Padding other)
| Parameter | Type | Description |
|---|---|---|
| other | Padding | An object to compare with this object. |
Returns
- bool:
trueif the current object is equal to theotherparameter; otherwise,false.
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override readonly bool Equals(object? obj)
| Parameter | Type | Description |
|---|---|---|
| obj | object | The object to compare with the current instance. |
Returns
- bool:
trueifobjand this instance are the same type and represent the same value; otherwise,false.
GetHashCode()
Returns the hash code for this instance.
public override readonly int GetHashCode()
Returns
- int:
A 32-bit signed integer that is the hash code for this instance.
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:
trueif the property values ofleftandrightare 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:
trueif the property values ofleftandrightare unequal; otherwise,false.
Inherited Members
- ValueType.ToString()
- object.GetType()
- object.Equals(object, object)
- object.ReferenceEquals(object, object)