有時候您會想要顯示沒有資料行標頭的 DataGridView。 在 DataGridView 控制項中,ColumnHeadersVisible 屬性值會決定是否要顯示該資料行標頭。
隱藏資料行標頭
將 DataGridView.ColumnHeadersVisible 屬性設定為
false。dataGridView1.ColumnHeadersVisible = false;dataGridView1.ColumnHeadersVisible = False
正在編譯程式碼
這個範例需要:
名為
dataGridView1的 DataGridView 控制項。System 和 System.Windows.Forms 組件的參考。