Biblioteca de clases de .NET Framework
TableLayoutColumnStyleCollection (Clase)
Actualización: noviembre 2007
Colección que almacena objetos ColumnStyle.
Ensamblado: System.Windows.Forms (en System.Windows.Forms.dll)
Sintaxis
Visual Basic (Declaración)
Public Class TableLayoutColumnStyleCollection _ Inherits TableLayoutStyleCollection
Visual Basic (Uso)
Dim instance As TableLayoutColumnStyleCollection
C#
public class TableLayoutColumnStyleCollection : TableLayoutStyleCollection
Visual C++
public ref class TableLayoutColumnStyleCollection : public TableLayoutStyleCollection
J#
public class TableLayoutColumnStyleCollection extends TableLayoutStyleCollection
JScript
public class TableLayoutColumnStyleCollection extends TableLayoutStyleCollection
Comentarios
La clase TableLayoutColumnStyleCollection representa la colección de todos los estilos utilizados para describir las columnas de un control TableLayoutPanel asociado.
Ejemplos
En el siguiente ejemplo se muestra cómo establecer ColumnStyle para TableLayoutColumnStyleCollection. Este ejemplo de código forma parte de un ejemplo más extenso referente al control TableLayoutPanel.
Visual Basic
Private Sub toggleColumnStylesBtn_Click( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles toggleColumnStylesBtn.Click Dim styles As TableLayoutColumnStyleCollection = _ Me.TableLayoutPanel1.ColumnStyles For Each style As ColumnStyle In styles If style.SizeType = SizeType.Absolute Then style.SizeType = SizeType.AutoSize ElseIf style.SizeType = SizeType.AutoSize Then style.SizeType = SizeType.Percent ' Set the column width to be a percentage ' of the TableLayoutPanel control's width. style.Width = 33 Else ' Set the column width to 50 pixels. style.SizeType = SizeType.Absolute style.Width = 50 End If Next End Sub
C#
private void toggleColumnStylesBtn_Click(
System.Object sender,
System.EventArgs e)
{
TableLayoutColumnStyleCollection styles =
this.TableLayoutPanel1.ColumnStyles;
foreach( ColumnStyle style in styles )
{
if( style.SizeType == SizeType.Absolute )
{
style.SizeType = SizeType.AutoSize;
}
else if( style.SizeType == SizeType.AutoSize )
{
style.SizeType = SizeType.Percent;
// Set the column width to be a percentage
// of the TableLayoutPanel control's width.
style.Width = 33;
}
else
{
// Set the column width to 50 pixels.
style.SizeType = SizeType.Absolute;
style.Width = 50;
}
}
}
Jerarquía de herencia
System.Object
System.Windows.Forms.TableLayoutStyleCollection
System.Windows.Forms.TableLayoutColumnStyleCollection
Seguridad para subprocesos
Todos los miembros static (Shared en Visual Basic) públicos de este tipo son seguros para la ejecución de subprocesos. No se garantiza que los miembros de instancias sean seguros para la ejecución de subprocesos.Plataformas
Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.
Información de versión
.NET Framework
Compatible con: 3.5, 3.0, 2.0Vea también