New to Telerik UI for WinForms? Start a free 30-day trial

Padding

Struct

Stores integer edge insets used for document layout, including page margins and table-cell padding. Edge values use the document layout's device-independent units.

Definition

Namespace:Telerik.WinForms.Documents.Layout

Assembly:Telerik.WinControls.RichTextEditor.dll

Syntax:

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

Constructors

Initializes the four edge insets independently.

C#
public Padding(int left, int top, int right, int bottom)
Parameters:leftint

The left edge inset.

topint

The top edge inset.

rightint

The right edge inset.

bottomint

The bottom edge inset.

Initializes all four edge insets to the same value.

C#
public Padding(int all)
Parameters:allint

The inset applied to each edge.

Copies the four edge values and reconstructs the uniform-padding state.

C#
public Padding(Padding other)
Parameters:otherPadding

The padding value to copy.

Fields

A padding value with zero inset on all four edges.

C#
public static readonly Padding Empty

Properties

Gets or sets a uniform inset for all four edges.

C#
public int All { get; set; }

The getter returns -1 when the all-edge mode is inactive. Setting an individual edge clears that mode, even when the edge value is unchanged.

Gets or sets the bottom edge inset, which contributes to Vertical.

C#
public int Bottom { get; set; }

Gets the sum of the left and right edge insets.

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

Gets or sets the left edge inset, which contributes to Horizontal.

C#
public int Left { get; set; }

Gets or sets the right edge inset, which contributes to Horizontal.

C#
public int Right { get; set; }

Gets the total horizontal and vertical inset, with width equal to Horizontal and height equal to Vertical.

C#
[Browsable(false)]
public Size Size { get; }

Gets or sets the top edge inset, which contributes to Vertical.

C#
public int Top { get; set; }

Gets the sum of the top and bottom edge insets.

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

Methods

Adds corresponding edge insets from two padding values.

C#
public static Padding Add(Padding padding1, Padding padding2)
Parameters:padding1Padding

The first padding value.

padding2Padding

The second padding value.

Returns:

Padding

A value containing the sum for each edge.

Determines whether the specified object has the same four edge insets as this value.

C#
public override bool Equals(object other)
Parameters:otherobject

The object to compare.

Returns:

bool

true when other is a Padding value with matching edges.

Overrides: ValueType.Equals(object)

Returns a hash code derived from the four edge insets.

C#
public override int GetHashCode()
Returns:

int

A hash code consistent with edge-based equality.

Overrides: ValueType.GetHashCode()

Subtracts each edge inset in the second value from the corresponding inset in the first.

C#
public static Padding Subtract(Padding padding1, Padding padding2)
Parameters:padding1Padding

The value from which to subtract.

padding2Padding

The edge values to subtract.

Returns:

Padding

A value containing the difference for each edge; negative results are preserved.

Returns the edge values in a labeled diagnostic format.

C#
public override string ToString()
Returns:

string

A string containing the left, top, right, and bottom values.

Overrides: ValueType.ToString()

Operators

Subtracts corresponding edge insets without clamping the result.

C#
public static Padding operator -(Padding padding1, Padding padding2)
Parameters:padding1Padding

The value from which to subtract.

padding2Padding

The edge values to subtract.

Returns:

Padding

A value containing the difference for each edge.

Determines whether at least one corresponding edge inset differs.

C#
public static bool operator !=(Padding padding1, Padding padding2)
Parameters:padding1Padding

The first padding value.

padding2Padding

The second padding value.

Returns:

bool

true when any corresponding edge is different.

Adds corresponding edge insets without clamping the result.

C#
public static Padding operator +(Padding padding1, Padding padding2)
Parameters:padding1Padding

The first padding value.

padding2Padding

The second padding value.

Returns:

Padding

A value containing the sum for each edge.

Determines whether all four edge insets are equal between two values.

C#
public static bool operator ==(Padding padding1, Padding padding2)
Parameters:padding1Padding

The first padding value.

padding2Padding

The second padding value.

Returns:

bool

true when each corresponding edge is equal.

Extension Methods