ScrollableControl.DockPadding Свойство

Определение

Получает параметры заполнения прикрепления для всех краев элемента управления.Gets the dock padding settings for all edges of the control.

public:
 property System::Windows::Forms::ScrollableControl::DockPaddingEdges ^ DockPadding { System::Windows::Forms::ScrollableControl::DockPaddingEdges ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.ScrollableControl.DockPaddingEdges DockPadding { get; }
public System.Windows.Forms.ScrollableControl.DockPaddingEdges DockPadding { get; }
[<System.ComponentModel.Browsable(false)>]
member this.DockPadding : System.Windows.Forms.ScrollableControl.DockPaddingEdges
member this.DockPadding : System.Windows.Forms.ScrollableControl.DockPaddingEdges
Public ReadOnly Property DockPadding As ScrollableControl.DockPaddingEdges

Значение свойства

ScrollableControl.DockPaddingEdges

Объект ScrollableControl.DockPaddingEdges, который предоставляет заполнение для всех краев прикрепленного элемента управления.A ScrollableControl.DockPaddingEdges that represents the padding for all the edges of a docked control.

Атрибуты

Примеры

В следующем примере кода используется производный класс Panel .The following code example uses the derived class, Panel. В примере кнопка закрепляется в элементе управления Panel и циклически проходит через ScrollableControl.DockPaddingEdges свойства, каждый из которых задается отдельно при нажатии кнопки.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. В этом примере необходимо создать экземпляр Panel элемента управления и в Button форме, а также объявить переменную-член уровня класса с именем в myCounter виде 32-разрядного целого числа со знаком.The example requires that you have created an instance of a Panel control and a Button on a form, and you have declared a class level member variable named myCounter as a 32-bit signed integer. Этот код следует вызывать в Click событии кнопки.You should call this code on the Click event of the button.

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

Комментарии

Это свойство управляет границей внутри этого элемента управления для закрепленных компонентов.This property controls the border inside of this control for docked components.

Применяется к

См. также раздел