TableLayoutPanel.CellBorderStyle 属性

定义

获取或设置单元格边框的样式。

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

属性值

描述表中所有单元格的边框样式的 TableLayoutPanelCellBorderStyle 值之一。 默认值为 None

例外

仅限 .NET 6 和更高版本:该属性值对于枚举类型无效。

示例

下面的代码示例根据所选 RadioButton设置 属性的值BorderStyle

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

注解

设置此值会导致面板重新绘制自身及其内容。

适用于

另请参阅