ScrollableControl.DockPaddingEdges.Left Propiedad
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Obtiene o establece el ancho del relleno del borde izquierdo de un control acoplado.
public:
property int Left { int get(); void set(int value); };
public int Left { get; set; }
member this.Left : int with get, set
Public Property Left As Integer
El ancho del relleno, en píxeles.
En el ejemplo de código siguiente se usa la clase derivada , Panel. El ejemplo acopla un botón en un control de panel y recorre las ScrollableControl.DockPaddingEdges propiedades, estableciendo cada uno individualmente en el clic del botón. Este código requiere que se haya creado una instancia de un Panel control en Button un formulario y se haya declarado una variable miembro de nivel de clase denominada myCounter
como un entero de 32 bits con signo. Se debe llamar a este código en el Click evento del botón.
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
El ancho de relleno asignado a esta propiedad solo se aplica al borde izquierdo del control acoplado.
Producto | Versiones |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
Comentarios de .NET
.NET es un proyecto de código abierto. Seleccione un vínculo para proporcionar comentarios: