ColumnStyle Classe
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Representa o aspeto e a sensação de uma coluna numa disposição de tabela.
public ref class ColumnStyle : System::Windows::Forms::TableLayoutStyle
public class ColumnStyle : System.Windows.Forms.TableLayoutStyle
type ColumnStyle = class
inherit TableLayoutStyle
Public Class ColumnStyle
Inherits TableLayoutStyle
- Herança
Exemplos
O exemplo de código seguinte demonstra como extrair um ColumnStyle de um TableLayoutColumnStyleCollection.
Este exemplo de código faz parte de um exemplo maior fornecido para a TableLayoutPanel classe.
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;
}
}
}
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
Observações
A ColumnStyle classe representa as características da interface de utilizador (UI) de uma coluna em TableLayoutPanel. Os estilos de todas as colunas de tal tabela são reunidos na TableLayoutPanel.ColumnStyles propriedade.
Esta classe simples oferece as Width propriedades e SizeType para uma coluna.
Construtores
| Name | Description |
|---|---|
| ColumnStyle() |
Inicializa uma nova instância da ColumnStyle classe para o seu estado padrão. |
| ColumnStyle(SizeType, Single) |
Inicializa uma nova instância da ColumnStyle classe usando os valores fornecidos SizeType e de largura. |
| ColumnStyle(SizeType) |
Inicializa uma nova instância da ColumnStyle classe usando o valor fornecido SizeType . |
Propriedades
| Name | Description |
|---|---|
| SizeType |
Recebe ou define um flag indicando como uma linha ou coluna deve ser dimensionada em relação à sua tabela que contém. (Herdado de TableLayoutStyle) |
| Width |
Obtém ou define o valor de largura de uma coluna. |
Métodos
| Name | Description |
|---|---|
| Equals(Object) |
Determina se o objeto especificado é igual ao objeto atual. (Herdado de Object) |
| GetHashCode() |
Serve como função de hash predefinida. (Herdado de Object) |
| GetType() |
Obtém o Type da instância atual. (Herdado de Object) |
| MemberwiseClone() |
Cria uma cópia superficial do atual Object. (Herdado de Object) |
| ToString() |
Devolve uma cadeia que representa o objeto atual. (Herdado de Object) |