3、可以綁定並顯示對象
Bind Objects to Windows Forms DataGridVIEw Controls
4、可以改變表格線條風格
Change the Border and Gridline Styles in the Windows Forms DataGridVIEw Control
Samples:
this.dataGridVIEw1.GridColor = Color.BlueViolet;
this.dataGridVIEw1.BorderStyle = BorderStyle.Fixed3D;
this.dataGridView1.CellBorderStyle = DataGridVIEwCellBorderStyle.None;
this.dataGridView1.RowHeadersBorderStyle = DataGridVIEwHeaderBorderStyle.Single;
this.dataGridView1.ColumnHeadersBorderStyle = DataGridVIEwHeaderBorderStyle.Single;
5、動態改變列是否顯示,和動態改變列的顯示順序
Change the Order of the Columns in the Windows Forms DataGridVIEw Control
Samples:
customersDataGridVIEw.Columns["CustomerID"].Visible = false;
customersDataGridVIEw.Columns["ContactName"].DisplayIndex = 0;
customersDataGridVIEw.Columns["ContactTitle"].DisplayIndex = 1;
customersDataGridVIEw.Columns["City"].DisplayIndex = 2;
customersDataGridVIEw.Columns["Country"].DisplayIndex = 3;
customersDataGridVIEw.Columns["CompanyName"].DisplayIndex = 4;
6、可以在列中顯示圖像
Display Images in Cells of the Windows Forms DataGridVIEw Control
Samples:
Icon treeIcon = new Icon(this.GetType(), "tree.ico");
DataGridViewImageColumn iconColumn = new DataGridVIEwImageColumn ();
iconColumn.Image = treeIcon.ToBitmap();
iconColumn.Name = "Tree";
iconColumn.HeaderText = "Nice tree";
dataGridVIEw1.Columns.Insert(2, iconColumn);