TableLayoutPanelGrowStyle Enumerazione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Specifica il modo in cui un oggetto TableLayoutPanel otterrà righe o colonne aggiuntive quando le celle esistenti risulteranno piene.
public enum class TableLayoutPanelGrowStyle
public enum TableLayoutPanelGrowStyle
type TableLayoutPanelGrowStyle =
Public Enum TableLayoutPanelGrowStyle
- Ereditarietà
Nome | Valore | Descrizione |
---|---|---|
AddColumns | 2 | L'oggetto TableLayoutPanel otterrà altre colonne quando sarà pieno. |
AddRows | 1 | L'oggetto TableLayoutPanel otterrà altre righe quando sarà pieno. |
FixedSize | 0 | L'oggetto TableLayoutPanel non consente l'aggiunta di altre righe o colonne quando è pieno. |
Nell'esempio seguente viene illustrato come utilizzare TableLayoutPanelGrowStyle
per impostare la TableLayoutPanel.GrowStyle proprietà . Questo esempio fa parte di un esempio più ampio fornito per il TableLayoutPanel controllo .
private void growStyleNoneBtn_CheckedChanged(
System.Object sender,
System.EventArgs e)
{
this.tlpGrowStyle = TableLayoutPanelGrowStyle.FixedSize;
}
private void growStyleAddRowBtn_CheckedChanged(
System.Object sender,
System.EventArgs e)
{
this.tlpGrowStyle = TableLayoutPanelGrowStyle.AddRows;
}
private void growStyleAddColumnBtn_CheckedChanged(
System.Object sender,
System.EventArgs e)
{
this.tlpGrowStyle = TableLayoutPanelGrowStyle.AddColumns;
}
private void testGrowStyleBtn_Click(
System.Object sender,
System.EventArgs e)
{
this.TableLayoutPanel1.GrowStyle = this.tlpGrowStyle;
try
{
this.TableLayoutPanel1.Controls.Add(new Button());
}
catch(ArgumentException ex)
{
Trace.WriteLine(ex.Message);
}
}
Private Sub growStyleNoneBtn_CheckedChanged( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles growStyleNoneBtn.CheckedChanged
Me.tlpGrowStyle = TableLayoutPanelGrowStyle.FixedSize
End Sub
Private Sub growStyleAddRowBtn_CheckedChanged( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles growStyleAddRowBtn.CheckedChanged
Me.tlpGrowStyle = TableLayoutPanelGrowStyle.AddRows
End Sub
Private Sub growStyleAddColumnBtn_CheckedChanged( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles growStyleAddColumnBtn.CheckedChanged
Me.tlpGrowStyle = TableLayoutPanelGrowStyle.AddColumns
End Sub
Private Sub testGrowStyleBtn_Click( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles testGrowStyleBtn.Click
Me.TableLayoutPanel1.GrowStyle = Me.tlpGrowStyle
Try
Me.TableLayoutPanel1.Controls.Add(New Button())
Catch ex As ArgumentException
Trace.WriteLine(ex.Message)
End Try
End Sub
Se tutte le celle in TableLayoutPanel vengono riempite e la GrowStyle proprietà è impostata su FixedSize, un tentativo di aggiungere un altro controllo genererà un'eccezione.
Prodotto | Versioni |
---|---|
.NET Framework | 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 |
Feedback su .NET
.NET è un progetto di open source. Selezionare un collegamento per fornire feedback: