DataGridView 控制項 (Windows Form)DataGridView Control (Windows Forms)

DataGridView 控制項以表格式顯示資料,是一項功能強大、有彈性的方式。The DataGridView control provides a powerful and flexible way to display data in a tabular format. 您可以使用 DataGridView 控制來顯示少量資料的唯讀檢視,或者您可以調整它的大小,以顯示非常大的資料集之可編輯檢視。You can use the DataGridView control to show read-only views of a small amount of data, or you can scale it to show editable views of very large sets of data.

您可以數種方式擴充 DataGridView 控制項,以建置自訂行為到您的應用程式中。You can extend the DataGridView control in a number of ways to build custom behaviors into your applications. 例如,您可以程式設計方式指定自己的排序演算法,而且也可以建立自己的儲存格類型。For example, you can programmatically specify your own sorting algorithms, and you can create your own types of cells. 您可以在數種屬性間做選擇,輕鬆自訂 DataGridView 控制項的外觀。You can easily customize the appearance of the DataGridView control by choosing among several properties. 許多類型的資料儲存區可用來做為資料來源,不然 DataGridView 控制項可在不使用與其繫結的資料來源之情況下運作。Many types of data stores can be used as a data source, or the DataGridView control can operate with no data source bound to it.

本節中的主題說明您可以用來將 DataGridView 功能建置在應用程式中的概念和技術。The topics in this section describe the concepts and techniques that you can use to build DataGridView features into your applications.

本節內容In This Section

DataGridView 控制項概觀DataGridView Control Overview
提供描述 Windows Form DataGridView 控制項架構和核心概念的主題。Provides topics that describe the architecture and core concepts of the Windows Forms DataGridView control.

Windows Forms DataGridView 控制項的預設功能Default Functionality in the Windows Forms DataGridView Control
描述當 Windows Form DataGridView 控制項繫結至資料來源時的預設外觀和行為。Describes the default appearance and behavior of the Windows Forms DataGridView control when it is bound to a data source.

Windows Forms DataGridView 控制項中的資料行類型Column Types in the Windows Forms DataGridView Control
描述在 Windows Form DataGridView 控制項中用於顯示資料,並允許使用者修改或加入資料的資料行類型。Describes the column types in the Windows Forms DataGridView control used to display data and allow users to modify or add data.

Windows Forms DataGridView 控制項中的基本資料行、資料列和儲存格功能Basic Column, Row, and Cell Features in the Windows Forms DataGridView Control
提供描述常用的儲存格、資料列和資料行屬性的主題。Provides topics that describe commonly-used cell, row, and column properties.

Windows Forms DataGridView 控制項中的基本格式化和樣式設定Basic Formatting and Styling in the Windows Forms DataGridView Control
提供主題描述如何修改控制項基本外觀和儲存格資料顯示格式。Provides topics that describe how to modify the basic appearance of the control and the display formatting of cell data.

在 Windows Forms DataGridView 控制項中顯示資料Displaying Data in the Windows Forms DataGridView Control
提供主題描述如何以手動方式或從外部資料來源將資料填入控制項。Provides topics that describe how to populate the control with data either manually, or from an external data source.

調整 Windows Forms DataGridView 控制項中資料行和資料列的大小Resizing Columns and Rows in the Windows Forms DataGridView Control
提供主題描述資料列和資料行大小可如何自動調整,以符合儲存格內容,或調整控制項可用寬度。Provides topics that describe how the size of rows and columns can be adjusted automatically to fit cell content or to fit the available width of the control.

在 Windows Forms DataGridView 控制項中排序資料Sorting Data in the Windows Forms DataGridView Control
提供描述控制項中排序功能的主題。Provides topics that describe the sorting features in the control.

Windows Forms DataGridView 控制項中的資料輸入Data Entry in the Windows Forms DataGridView Control
提供主題描述如何變更使用者加入和修改控制項資料的方式。Provides topics that describe how to change the way users add and modify data in the control.

選取範圍和剪貼簿與 Windows Forms DataGridView 控制項搭配使用Selection and Clipboard Use with the Windows Forms DataGridView Control
提供主題描述控制項中儲存格、資料列和資料行的選取功能。Provides topics that describe the cell, row, and column selection features in the control.

在 Windows Forms DataGridView 控制項中利用儲存格、資料列和資料行進行程式設計Programming with Cells, Rows, and Columns in the Windows Forms DataGridView Control
提供主題描述如何使用儲存格、資料列和資料行物件進行程式設計。Provides topics that describe how to program with cell, row, and column objects.

自訂 Windows Forms DataGridView 控制項Customizing the Windows Forms DataGridView Control
提供主題描述自訂繪製 DataGridView 儲存格和資料列,並建立衍生儲存格、資料行和資料列類型。Provides topics that describe custom painting DataGridView cells and rows, and creating derived cell, column, and row types.

Windows Forms DataGridView 控制項中的效能微調Performance Tuning in the Windows Forms DataGridView Control
提供主題描述處理大量資料時,如何有效率地使用控制項來避免發生效能問題。Provides topics that describe how to use the control efficiently to avoid performance problems when working with large amounts of data.

Windows Forms DataGridView 控制項中的預設鍵盤和滑鼠處理Default Keyboard and Mouse Handling in the Windows Forms DataGridView Control
描述使用者可如何透過鍵盤和滑鼠與 DataGridView 控制項互動。Describes how users can interact with the DataGridView control through a keyboard and a mouse.

Windows Forms DataGridView 和 DataGrid 控制項之間的差異Differences Between the Windows Forms DataGridView and DataGrid Controls
描述 DataGridView 控制項如何改良並取代 DataGrid 控制項。Describes how the DataGridView control improves upon and replaces the DataGrid control.

另請參閱使用設計工具搭配 Windows Form DataGridView 控制項Also see Using the Designer with the Windows Forms DataGridView Control.

參考資料Reference

DataGridView
提供 DataGridView 控制項的參考文件。Provides reference documentation for the DataGridView control.

BindingSource
提供 BindingSource 元件的參考文件。Provides reference documentation for the BindingSource component. DataGridView 控制項和 BindingSource 元件設計為可密切合作。The DataGridView control and the BindingSource component are designed to work closely together.

另請參閱See also