DataGridViewBand.Visible 属性

定义

获取或设置一个值,该值指示带区对于用户是否可见。Gets or sets a value indicating whether the band is visible to the user.

public:
 virtual property bool Visible { bool get(); void set(bool value); };
public virtual bool Visible { get; set; }
member this.Visible : bool with get, set
Public Overridable Property Visible As Boolean

属性值

如果带区可见,则为 true;否则为 falsetrue if the band is visible; otherwise, false. 默认值为 trueThe default is true.

例外

设置此属性时指定的值为 false,并且带区为用于存储新记录的行。The specified value when setting this property is false and the band is the row for new records.

示例

下面的代码示例演示如何使用Visible属性隐藏行。The following code example demonstrates how to use the Visible property to hide a row. 此代码示例是为DataGridViewBand类提供的更大示例的一部分。This code example is part of a larger example provided for the DataGridViewBand class.

// Hide a band of cells.
void Button6_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
   DataGridViewBand^ band = dataGridView->Rows[ 3 ];
   band->Visible = false;
}


// Hide a band of cells.
private void Button6_Click(object sender, System.EventArgs e)
{

    DataGridViewBand band = dataGridView.Rows[3];
    band.Visible = false;
}
' Hide a band of cells.
Private Sub Button6_Click(ByVal sender As Object, _
    ByVal e As System.EventArgs) Handles Button6.Click

    Dim band As DataGridViewBand = dataGridView.Rows(3)
    band.Visible = False
End Sub

注解

此属性可用于隐藏无关列或行。This property can be used to hide extraneous columns or rows.

适用于

另请参阅