DataGridViewRow.Visible 屬性

定義

取得或設定值,指出資料列是否可見。

public:
 virtual property bool Visible { bool get(); void set(bool value); };
[System.ComponentModel.Browsable(false)]
public override bool Visible { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.Visible : bool with get, set
Public Overrides Property Visible As Boolean

屬性值

如果資料列可見,則為 true,否則為 false

屬性

例外狀況

資料列位於 DataGridView 控制項中而且是一個共用資料列。

範例

下列程式碼範例示範如何使用 DataGridViewBand.Visible 屬性,這與 類別的 DataGridViewRow 屬性幾乎相同 Visible 。 此程式碼範例是針對 類別提供的較大範例的 DataGridViewBand 一部分。

// 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

備註

使用這個屬性可隱藏檢視中的資料列,同時將資料列保留在 中 DataGridView 。 若要完全移除資料列,請使用 DataGridViewRowCollection.Remove 方法。

適用於

另請參閱