ScrollableControl.DockPaddingEdges ScrollableControl.DockPaddingEdges ScrollableControl.DockPaddingEdges ScrollableControl.DockPaddingEdges Class

定义

确定停靠控件的边界边距。Determines the border padding for docked controls.

public: ref class ScrollableControl::DockPaddingEdges : ICloneable
[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.ScrollableControl/DockPaddingEdgesConverter))]
public class ScrollableControl.DockPaddingEdges : ICloneable
type ScrollableControl.DockPaddingEdges = class
    interface ICloneable
Public Class ScrollableControl.DockPaddingEdges
Implements ICloneable
继承
ScrollableControl.DockPaddingEdgesScrollableControl.DockPaddingEdgesScrollableControl.DockPaddingEdgesScrollableControl.DockPaddingEdges
属性
实现

示例

下面的代码示例使用派生的类中, PanelThe following code example uses the derived class, 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 位有符号整数。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. 此代码应在调用Click按钮的事件。This code should be called 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

注解

ScrollableControl.DockPaddingEdges类创建一个给定的边缘或停靠控件所有边缘上边距。The ScrollableControl.DockPaddingEdges class creates a margin on a given edge or all edges of a docked control. 通过设置以下属性可设置每个单独边缘此边距的宽度: BottomTopLeftRightYou can set the width of this margin for each individual edge by setting the following properties: Bottom, Top, Left, Right. 或者,您可以设置所有边缘为相同的宽度同时通过设置All属性。Alternatively, you can set all the edges to the same width simultaneously by 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.

属性

All All All All

获取或设置停靠控件的所有边缘的边距宽度。Gets or sets the padding width for all edges of a docked control.

Bottom Bottom Bottom Bottom

获取或设置停靠控件的下边缘的边距宽度。Gets or sets the padding width for the bottom edge of a docked control.

Left Left Left Left

获取或设置停靠控件的左边缘的边距宽度。Gets or sets the padding width for the left edge of a docked control.

Right Right Right Right

获取或设置停靠控件的右边缘的边距宽度。Gets or sets the padding width for the right edge of a docked control.

Top Top Top Top

获取或设置停靠控件的顶边缘的边距宽度。Gets or sets the padding width for the top edge of a docked control.

方法

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

确定指定的对象是否等于当前 ScrollableControl.DockPaddingEdges 对象。Determines whether the specified object is equal to the current ScrollableControl.DockPaddingEdges object.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

用作特定类型的哈希函数。Serves as a hash function for a particular type.

GetType() GetType() GetType() GetType()

获取当前实例的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

返回空字符串。Returns an empty string.

显式界面实现

ICloneable.Clone() ICloneable.Clone() ICloneable.Clone() ICloneable.Clone()

创建作为当前实例副本的新对象。Creates a new object that is a copy of the current instance.

适用于

另请参阅