Determines the border padding for docked controls.
Object
ScrollableControl.DockPaddingEdges
[Visual Basic] Public Class ScrollableControl.DockPaddingEdges [C#] public class ScrollableControl.DockPaddingEdges [C++] public __gc class ScrollableControl.DockPaddingEdges [JScript] public class ScrollableControl.DockPaddingEdges
The ScrollableControl.DockPaddingEdges class creates a margin on a given edge or all edges of a docked control. You may set the width of this margin for each individual edge by setting the following properties: Bottom, Top, Left, Right. Alternatively you may set all the edges to the same width simultaneously be setting the All property. If the size of the control is too large for its container, the control will be resized to fit in the container minus the specified margin width.
Namespace: System.WinForms
Assembly: System.WinForms.dll
The following example uses the derived class, Panel. The example docks a button in a panel control and cycles through the System.WinForms.ScrollableControl$DockPaddingEdges properties, setting each individually on the click of the button. This code assumes a Panel control and a Button have been instantiated on a form. This code shold be called on the OnClick event of the button.
[Visual Basic]
Private Sub MySub() ' Create a static integer variable. Static Dim myCounter As Integer ' Dock the button in the panel. Button1.Dock = System.WinForms.DockStyle.Fill ' Reset the counter if it is greater than 5. If myCounter > 5 Then myCounter = 0 End If ' Set the appropriate DockPadding and display ' which one was set on the button face. Select Case myCounter Case 0 Panel1.DockPadding.All = 0 Button1.Text = "Start" Case 1 Panel1.DockPadding.Top = 10 Button1.Text = "Top" Case 2 Panel1.DockPadding.Bottom = 10 Button1.Text = "Bottom" Case 3 Panel1.DockPadding.Left = 10 Button1.Text = "Left" Case 4 Panel1.DockPadding.Right = 10 Button1.Text = "Right" Case 5 Panel1.DockPadding.All = 20 Button1.Text = "All" End Select ' Increment the counter. myCounter = myCounter + 1 End Sub
ScrollableControl.DockPaddingEdges Members | System.WinForms Namespace