ScrollableControl.DockPaddingEdges 類別

定義

決定停駐控制項的邊線填補。

public: ref class ScrollableControl::DockPaddingEdges : ICloneable
[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.ScrollableControl+DockPaddingEdgesConverter))]
public class ScrollableControl.DockPaddingEdges : ICloneable
[<System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.ScrollableControl+DockPaddingEdgesConverter))>]
type ScrollableControl.DockPaddingEdges = class
    interface ICloneable
Public Class ScrollableControl.DockPaddingEdges
Implements ICloneable
繼承
ScrollableControl.DockPaddingEdges
屬性
實作

範例

下列程式碼範例使用衍生類別 。 Panel 此範例會將按鈕停駐在面板控制項中,並迴圈流覽 ScrollableControl.DockPaddingEdges 屬性,在每個按鈕按一下時個別設定。 此程式碼要求 Panel 控制項和 Button 已在表單上具現化,而名為 myCounter 的類別層級成員變數已宣告為 32 位帶正負號的整數。 此程式碼應該在 Click 按鈕的事件上呼叫。

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";
         break;

      case 1:
         panel1->DockPadding->Top = 10;
         button1->Text = "Top";
         break;

      case 2:
         panel1->DockPadding->Bottom = 10;
         button1->Text = "Bottom";
         break;

      case 3:
         panel1->DockPadding->Left = 10;
         button1->Text = "Left";
         break;

      case 4:
         panel1->DockPadding->Right = 10;
         button1->Text = "Right";
         break;

      case 5:
         panel1->DockPadding->All = 20;
         button1->Text = "All";
         break;
   }
   myCounter++;
}
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";
          break;
       case 1:
          panel1.DockPadding.Top = 10;
          button1.Text = "Top";
          break;
       case 2:
          panel1.DockPadding.Bottom = 10;
          button1.Text = "Bottom";
          break;
       case 3:
          panel1.DockPadding.Left = 10;
          button1.Text = "Left";
          break;
       case 4:
          panel1.DockPadding.Right = 10;
          button1.Text = "Right";
          break;
       case 5:
          panel1.DockPadding.All = 20;
          button1.Text = "All";
          break;
    }
    
    // Increment the counter.
    myCounter += 1;
 }
Private Sub 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 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 += 1
End Sub

備註

類別 ScrollableControl.DockPaddingEdges 會在指定的邊緣或停駐控制項的所有邊緣上建立邊界。 您可以藉由設定下列屬性,為每個個別邊緣設定此邊界的寬度: Bottom 、、 TopLeftRight 。 或者,您可以藉由設定 屬性,同時將所有邊緣設定 All 為相同的寬度。 如果控制項的大小對容器而言太大,控制項的大小將會調整大小以符合容器,減去指定的邊界寬度。

屬性

All

取得或設定停駐控制項所有邊緣的填補寬度。

Bottom

取得或設定停駐控制項下邊緣的填補寬度。

Left

取得或設定停駐控制項左邊緣的填補寬度。

Right

取得或設定停駐控制項右邊緣的填補寬度。

Top

取得或設定停駐控制項上邊緣的填補寬度。

方法

Equals(Object)

此 API 支援此產品基礎結構,但無法直接用於程式碼之中。

判斷指定的物件是否等於目前的 ScrollableControl.DockPaddingEdges 物件。

GetHashCode()

以特定類型的雜湊函式進行服務。

GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回空字串。

明確介面實作

ICloneable.Clone()

建立目前執行個體複本的新物件。

適用於

另請參閱