Padding Structure
TOC
Collapse the table of content
Expand the table of content

Padding Structure

 

Represents padding or margin information associated with a user interface (UI) element.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

[<Sealed>]
[<SerializableAttribute>]
[<TypeConverterAttribute(typeof(PaddingConverter))>]
type Padding = struct end

NameDescription
System_CAPS_pubmethodPadding(Int32)

Initializes a new instance of the Padding class using the supplied padding size for all edges.

System_CAPS_pubmethodPadding(Int32, Int32, Int32, Int32)

Initializes a new instance of the Padding class using a separate padding size for each edge.

NameDescription
System_CAPS_pubpropertyAll

Gets or sets the padding value for all the edges.

System_CAPS_pubpropertyBottom

Gets or sets the padding value for the bottom edge.

System_CAPS_pubpropertyHorizontal

Gets the combined padding for the right and left edges.

System_CAPS_pubpropertyLeft

Gets or sets the padding value for the left edge.

System_CAPS_pubpropertyRight

Gets or sets the padding value for the right edge.

System_CAPS_pubpropertySize

Gets the padding information in the form of a System.Drawing.Size.

System_CAPS_pubpropertyTop

Gets or sets the padding value for the top edge.

System_CAPS_pubpropertyVertical

Gets the combined padding for the top and bottom edges.

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticAdd(Padding, Padding)

Computes the sum of the two specified Padding values.

System_CAPS_pubmethodEquals(Object)

Determines whether the value of the specified object is equivalent to the current Padding.(Overrides ValueType.Equals(Object).)

System_CAPS_pubmethodGetHashCode()

Generates a hash code for the current Padding. (Overrides ValueType.GetHashCode().)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticSubtract(Padding, Padding)

Subtracts one specified Padding value from another.

System_CAPS_pubmethodToString()

Returns a string that represents the current Padding.(Overrides ValueType.ToString().)

NameDescription
System_CAPS_pubfieldSystem_CAPS_staticEmpty

Provides a Padding object with no padding.

NameDescription
System_CAPS_puboperatorSystem_CAPS_staticAddition(Padding, Padding)

Performs vector addition on the two specified Padding objects, resulting in a new Padding.

System_CAPS_puboperatorSystem_CAPS_staticEquality(Padding, Padding)

Tests whether two specified Padding objects are equivalent.

System_CAPS_puboperatorSystem_CAPS_staticInequality(Padding, Padding)

Tests whether two specified Padding objects are not equivalent.

System_CAPS_puboperatorSystem_CAPS_staticSubtraction(Padding, Padding)

Performs vector subtraction on the two specified Padding objects, resulting in a new Padding.

The Padding structure represents the padding or margin associated with a rectangular UI element such as a control. The padding is the internal space between the body of the UI element and its edge. In contrast, a margin is the distance separating the adjoining edges of two adjacent UI elements. Because of structural similarities, Padding is used to represent both padding and margins.

For a diagram that illustrates the Padding and Margin properties on a control, see Margin and Padding in Windows Forms Controls.

Padding has a different effect on controls that are containers than on controls that are not. For example, in a Panel control, the Padding property defines the spacing between the border of the Panel and its child controls. For a Button control, the Padding property defines the spacing between the border of the Button control and its contained text.

In addition to typical methods and properties, Padding also defines the following type-level members:

  • The Empty field, which represents a predefined Padding with no padding.

  • A set of operators for performing common arithmetic operations for the class, such as adding two Padding objects together. For languages that do not support operator overloading, you can invoke these members by using alternative method syntax.

  • The Horizontal, Vertical, and Size properties, which provide combined values that are convenient for use in custom layout calculations.

The following code example demonstrates how to use the Padding property to create an outline around a RichTextBox control.

For a full code listing, see How to: Create a Border Around a Windows Forms Control Using Padding.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft