DockStyle DockStyle DockStyle DockStyle Enum

Definición

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

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

Campos

Bottom Bottom Bottom Bottom 2

Parte inferior del control se acopla a la parte inferior de su control contenedor.The control's bottom edge is docked to the bottom of its containing control.

Fill Fill Fill Fill 5

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

Left Left Left Left 3

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

None None None None 0

No está acoplado el control.The control is not docked.

Right Right Right Right 4

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

Top Top Top Top 1

Borde superior del control se acopla a la parte 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 crea un GroupBox y se establecen algunas de sus propiedades comunes.The following example creates a GroupBox and sets some of its common properties. El ejemplo se crea un TextBox y establece su Location dentro del 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 lo acopla el grupo de cuadro a 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 el Enabled propiedad false, lo que hace que todos los controles contenidos en el cuadro de grupo va a deshabilitar.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 vaciado respecto al 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 más de un control se acopla a un borde, aparecen los controles según su orden z; en paralelo más arriba en el orden z de los controles 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 la izquierda, derecha, superior o inferior, el especificado y opuesta bordes del control cambian de tamaño para el 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 el relleno, los cuatro lados del control cambian de tamaño 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: