ScrollableControl.DockPaddingEdges.Right Property

Gets or sets the padding width for the right edge of a docked control.

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

public int Right { get; set; }
/** @property */
public int get_Right ()

/** @property */
public void set_Right (int value)

public function get Right () : int

public function set Right (value : int)

Not applicable.

Property Value

The padding width, in pixels.

The padding width assigned to this property is applied only to the right edge of the docked control.

The following code example uses the derived class, Panel. The example docks a button in a panel control and cycles through the ScrollableControl.DockPaddingEdges properties, setting each individually on the click of the button. This code requires that a Panel control and a Button have been instantiated on a form, and a class-level member variable named myCounter has been declared as a 32-bit signed integer. This code should be called on the Click event of the button.

private void SetDockPadding()
    // Dock the button in the panel.
    button1.Dock = System.Windows.Forms.DockStyle.Fill;
    // Reset the counter if it is greater than 5.
    if (myCounter > 5)
       myCounter = 0;
    /* Set the appropriate DockPadding and display
       which one was set on the button face. */
    switch (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";
    // Increment the counter.
    myCounter += 1;

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0