TableLayoutPanel.RowStyles Propriedade
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.
Obtém uma coleção de estilos de carreiras para o TableLayoutPanel.
public:
property System::Windows::Forms::TableLayoutRowStyleCollection ^ RowStyles { System::Windows::Forms::TableLayoutRowStyleCollection ^ get(); };
[System.ComponentModel.Browsable(false)]
public System.Windows.Forms.TableLayoutRowStyleCollection RowStyles { get; }
[<System.ComponentModel.Browsable(false)>]
member this.RowStyles : System.Windows.Forms.TableLayoutRowStyleCollection
Public ReadOnly Property RowStyles As TableLayoutRowStyleCollection
Valor de Propriedade
A TableLayoutRowStyleCollection contendo a RowStyle para cada linha no TableLayoutPanel controlo.
- Atributos
Exemplos
O exemplo de código seguinte define as RowStyle propriedades de cada linha quando a Button é clicada.
private void toggleRowStylesBtn_Click(
System.Object sender,
System.EventArgs e)
{
TableLayoutRowStyleCollection styles =
this.TableLayoutPanel1.RowStyles;
foreach( RowStyle style in styles )
{
if (style.SizeType==SizeType.Absolute)
{
style.SizeType = SizeType.AutoSize;
}
else if(style.SizeType==SizeType.AutoSize)
{
style.SizeType = SizeType.Percent;
// Set the row height to be a percentage
// of the TableLayoutPanel control's height.
style.Height = 33;
}
else
{
// Set the row height to 50 pixels.
style.SizeType = SizeType.Absolute;
style.Height = 50;
}
}
}
Private Sub toggleRowStylesBtn_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles toggleRowStylesBtn.Click
Dim styles As TableLayoutRowStyleCollection = _
Me.TableLayoutPanel1.RowStyles
For Each style As RowStyle In styles
If style.SizeType = SizeType.Absolute Then
style.SizeType = SizeType.AutoSize
ElseIf style.SizeType = SizeType.AutoSize Then
style.SizeType = SizeType.Percent
' Set the row height to be a percentage
' of the TableLayoutPanel control's height.
style.Height = 33
Else
' Set the row height to 50 pixels.
style.SizeType = SizeType.Absolute
style.Height = 50
End If
Next
End Sub
Observações
Use a RowStyles propriedade para aceder às propriedades de estilo de linhas específicas. Pode usar membros da RowStyle classe para definir as características das linhas individuais na tabela.
Quando o TableLayoutPanel controlo organiza as suas linhas, atribui prioridades a cada uma RowStyle na seguinte ordem:
As linhas com RowStyle definido em Absolute são consideradas primeiro, e as suas alturas fixas são atribuídas.
As filas com RowStyle definido para AutoSize são dimensionadas de acordo com o seu conteúdo.
O espaço restante é dividido entre linhas com RowStyle o conjunto de Percent.