DockStyle Enumeración

Definición

Especifica la posición y la forma en la que se acopla un control.Specifies the position and manner in which a control is docked.

public enum class DockStyle
public enum DockStyle
type DockStyle = 
Public Enum DockStyle
Herencia
DockStyle

Campos

Bottom 2

El margen inferior del control se acopla al margen inferior de su control contenedor.The control's bottom edge is docked to the bottom of its containing control.

Fill 5

Todos los bordes del control se acoplan a los bordes de su control contenedor y se cambian de tamaño de forma pertinente.All the control's edges are docked to the all edges of its containing control and sized appropriately.

Left 3

El margen izquierdo del control se acopla al margen izquierdo de su control contenedor.The control's left edge is docked to the left edge of its containing control.

None 0

El control no se acopla.The control is not docked.

Right 4

El margen derecho del control se acopla al margen derecho de su control contenedor.The control's right edge is docked to the right edge of its containing control.

Top 1

El margen superior del control se acopla al margen superior de su control contenedor.The control's top edge is docked to the top of its containing control.

Ejemplos

En el ejemplo siguiente se GroupBox crea un y se establecen algunas de sus propiedades comunes.The following example creates a GroupBox and sets some of its common properties. En el ejemplo se TextBox crea un y Location se establece su en el cuadro de grupo.The example creates a TextBox and sets its Location within the group box. A continuación, establece la Text propiedad del cuadro de grupo y acopla el cuadro de grupo en la parte superior del formulario.Next, it sets the Text property of the group box, and docks the group box to the top of the form. Por último, deshabilita el cuadro de grupo estableciendo la Enabled propiedad en false, lo que hace que todos los controles contenidos en el cuadro de grupo estén deshabilitados.Lastly, it disables the group box by setting the Enabled property to false, which causes all controls contained within the group box to be disabled.

   // Add a GroupBox to a form and set some of its common properties.
private:
   void AddMyGroupBox()
   {
      // Create a GroupBox and add a TextBox to it.
      GroupBox^ groupBox1 = gcnew GroupBox;
      TextBox^ textBox1 = gcnew TextBox;
      textBox1->Location = Point(15,15);
      groupBox1->Controls->Add( textBox1 );

      // Set the Text and Dock properties of the GroupBox.
      groupBox1->Text = "MyGroupBox";
      groupBox1->Dock = DockStyle::Top;

      // Disable the GroupBox (which disables all its child controls)
      groupBox1->Enabled = false;

      // Add the Groupbox to the form.
      this->Controls->Add( groupBox1 );
   }
// Add a GroupBox to a form and set some of its common properties.
private void AddMyGroupBox()
{
   // Create a GroupBox and add a TextBox to it.
   GroupBox groupBox1 = new GroupBox();
   TextBox textBox1 = new TextBox();
   textBox1.Location = new Point(15, 15);
   groupBox1.Controls.Add(textBox1);

   // Set the Text and Dock properties of the GroupBox.
   groupBox1.Text = "MyGroupBox";
   groupBox1.Dock = DockStyle.Top;

   // Disable the GroupBox (which disables all its child controls)
   groupBox1.Enabled = false;

   // Add the Groupbox to the form.
   this.Controls.Add(groupBox1);
}
' Add a GroupBox to a form and set some of its common properties.
Private Sub AddMyGroupBox()
   ' Create a GroupBox and add a TextBox to it.
   Dim groupBox1 As New GroupBox()
   Dim textBox1 As New TextBox()
   textBox1.Location = New Point(15, 15)
   groupBox1.Controls.Add(textBox1)
   
   ' Set the Text and Dock properties of the GroupBox.
   groupBox1.Text = "MyGroupBox"
   groupBox1.Dock = DockStyle.Top
   
   ' Disable the GroupBox (which disables all its child controls)
   groupBox1.Enabled = False
   
   ' Add the Groupbox to the form.
   Me.Controls.Add(groupBox1)
End Sub

Comentarios

Cuando un control se acopla a un borde de su contenedor, siempre se coloca en el vaciado de ese borde cuando se cambia el tamaño del contenedor.When a control is docked to an edge of its container, it is always positioned flush against that edge when the container is resized. Si hay más de un control acoplado a un borde, los controles aparecen en paralelo según su orden z; los controles situados más arriba en el orden z se colocan más lejos del borde del contenedor.If more than one control is docked to an edge, the controls appear side by side according to their z-order; controls higher in the z-order are positioned farther from the container's edge.

Si se selecciona izquierda, derecha, superior o inferior, se cambia el tamaño de los bordes opuestos y especificados del control al tamaño de los bordes correspondientes del control contenedor.If Left, Right, Top, or Bottom is selected, the specified and opposite edges of the control are resized to the size of the containing control's corresponding edges. Si se selecciona relleno, se cambia el tamaño de los cuatro lados del control para que coincidan con los bordes del control contenedor.If Fill is selected, all four sides of the control are resized to match the containing control's edges.

Se aplica a

Consulte también: