Rediger

Del via


TableLayoutPanel.CellBorderStyle Property

Definition

Gets or sets the style of the cell borders.

public:
 property System::Windows::Forms::TableLayoutPanelCellBorderStyle CellBorderStyle { System::Windows::Forms::TableLayoutPanelCellBorderStyle get(); void set(System::Windows::Forms::TableLayoutPanelCellBorderStyle value); };
public System.Windows.Forms.TableLayoutPanelCellBorderStyle CellBorderStyle { get; set; }
member this.CellBorderStyle : System.Windows.Forms.TableLayoutPanelCellBorderStyle with get, set
Public Property CellBorderStyle As TableLayoutPanelCellBorderStyle

Property Value

One of the TableLayoutPanelCellBorderStyle values describing the style of all the cell borders in the table. The default is None.

Exceptions

.NET 6 and later versions only: The property value is not valid for the enumeration type.

Examples

The following code example sets the value of the BorderStyle property depending on the selected RadioButton.

private void borderStyleOutsetRadioBtn_CheckedChanged(
    System.Object sender, 
    System.EventArgs e)
{
    this.TableLayoutPanel1.CellBorderStyle = 
        TableLayoutPanelCellBorderStyle.Outset;
}

private void borderStyleNoneRadioBtn_CheckedChanged(
    System.Object sender, 
    System.EventArgs e)
{
    this.TableLayoutPanel1.CellBorderStyle = 
        TableLayoutPanelCellBorderStyle.None;
}

private void borderStyleInsetRadioBtn_CheckedChanged(
    System.Object sender, 
    System.EventArgs e)
{
    this.TableLayoutPanel1.CellBorderStyle = 
        TableLayoutPanelCellBorderStyle.Inset;
}
Private Sub borderStyleOutsetRadioBtn_CheckedChanged( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles borderStyleOutsetRadioBtn.CheckedChanged

    Me.TableLayoutPanel1.CellBorderStyle = TableLayoutPanelCellBorderStyle.Outset

End Sub

Private Sub borderStyleNoneRadioBtn_CheckedChanged( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles borderStyleNoneRadioBtn.CheckedChanged

    Me.TableLayoutPanel1.CellBorderStyle = TableLayoutPanelCellBorderStyle.None

End Sub

Private Sub borderStyleInsetRadioBtn_CheckedChanged( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles borderStyleInsetRadioBtn.CheckedChanged

    Me.TableLayoutPanel1.CellBorderStyle = TableLayoutPanelCellBorderStyle.Inset

End Sub

Remarks

Setting this value causes the panel to redraw itself and its contents.

Applies to

See also