DataGridViewTextBoxColumn DataGridViewTextBoxColumn DataGridViewTextBoxColumn DataGridViewTextBoxColumn Class

定義

裝載 DataGridViewTextBoxCell 儲存格的集合。Hosts a collection of DataGridViewTextBoxCell cells.

public ref class DataGridViewTextBoxColumn : System::Windows::Forms::DataGridViewColumn
[System.Drawing.ToolboxBitmap(typeof(System.Windows.Forms.DataGridViewTextBoxColumn), "DataGridViewTextBoxColumn.bmp")]
[System.Drawing.ToolboxBitmap(typeof(System.Windows.Forms.DataGridViewTextBoxColumn), "DataGridViewTextBoxColumn")]
public class DataGridViewTextBoxColumn : System.Windows.Forms.DataGridViewColumn
type DataGridViewTextBoxColumn = class
    inherit DataGridViewColumn
Public Class DataGridViewTextBoxColumn
Inherits DataGridViewColumn
繼承
屬性

範例

下列程式碼範例說明如何使用此類型。The following code example illustrates the use of this type.

DataGridViewTextBoxColumn titleColumn =
    new DataGridViewTextBoxColumn();
titleColumn.HeaderText = "Title";
titleColumn.AutoSizeMode =
    DataGridViewAutoSizeColumnMode.AllCellsExceptHeader;
Dim titleColumn As New DataGridViewTextBoxColumn()
titleColumn.HeaderText = "Title"
titleColumn.AutoSizeMode = _
    DataGridViewAutoSizeColumnMode.AllCellsExceptHeader

備註

類別是特殊類型的DataGridViewColumn類別, 用來以邏輯方式主控資料格, 以啟用文字字串的顯示和編輯。 DataGridViewTextBoxColumnThe DataGridViewTextBoxColumn class is a specialized type of DataGridViewColumn class used to logically host cells that enable displaying and editing of text strings. DataGridViewTextBoxColumn DataGridViewTextBoxCell每一個DataGridViewRow中都有相關聯的物件與它相交。A DataGridViewTextBoxColumn has an associated DataGridViewTextBoxCell object in every DataGridViewRow that intersects it. 當啟用時, 它會DataGridViewTextBoxEditingControl提供控制項來處理使用者輸入。 DataGridViewTextBoxCellWhen a DataGridViewTextBoxCell becomes activated, it supplies a DataGridViewTextBoxEditingControl control to handle user input.

此資料行類型的排序模式預設為AutomaticThe sort mode for this column type defaults to Automatic.

給繼承者的注意事項

當您衍生自DataGridViewTextBoxColumn並將新的屬性加入至衍生類別時, 請務必覆Clone()寫方法, 以便在複製作業期間複製新的屬性。When you derive from DataGridViewTextBoxColumn and add new properties to the derived class, be sure to override the Clone() method to copy the new properties during cloning operations. 您也應該呼叫基類的Clone()方法, 以便將基類的屬性複製到新的資料格。You should also call the base class's Clone() method so that the properties of the base class are copied to the new cell.

建構函式

DataGridViewTextBoxColumn() DataGridViewTextBoxColumn() DataGridViewTextBoxColumn() DataGridViewTextBoxColumn()

初始化 DataGridViewTextBoxColumn 類別的新執行個體為預設狀態。Initializes a new instance of the DataGridViewTextBoxColumn class to the default state.

屬性

AutoSizeMode AutoSizeMode AutoSizeMode AutoSizeMode

取得或設定資料行自動調整其寬度所根據的模式。Gets or sets the mode by which the column automatically adjusts its width.

(Inherited from DataGridViewColumn)
CellTemplate CellTemplate CellTemplate CellTemplate

取得或設定用來建立儲存格外觀模型的樣板。Gets or sets the template used to model cell appearance.

CellType CellType CellType CellType

取得儲存格樣板的執行階段類型。Gets the run-time type of the cell template.

(Inherited from DataGridViewColumn)
ContextMenuStrip ContextMenuStrip ContextMenuStrip ContextMenuStrip

取得或設定資料行的捷徑功能表。Gets or sets the shortcut menu for the column.

(Inherited from DataGridViewColumn)
DataGridView DataGridView DataGridView DataGridView

取得與這個項目有關聯的 DataGridView 控制項。Gets the DataGridView control associated with this element.

(Inherited from DataGridViewElement)
DataPropertyName DataPropertyName DataPropertyName DataPropertyName

取得或設定 DataGridViewColumn 所繫結的資料來源屬性或資料庫資料行的名稱。Gets or sets the name of the data source property or database column to which the DataGridViewColumn is bound.

(Inherited from DataGridViewColumn)
DefaultCellStyle DefaultCellStyle DefaultCellStyle DefaultCellStyle

取得或設定資料行的預設儲存格樣式。Gets or sets the column's default cell style.

(Inherited from DataGridViewColumn)
DefaultHeaderCellType DefaultHeaderCellType DefaultHeaderCellType DefaultHeaderCellType

取得或設定預設標題儲存格的執行階段型別。Gets or sets the run-time type of the default header cell.

(Inherited from DataGridViewBand)
Displayed Displayed Displayed Displayed

取得值,指出此群組列目前是否顯示在螢幕上。Gets a value indicating whether the band is currently displayed onscreen.

(Inherited from DataGridViewBand)
DisplayIndex DisplayIndex DisplayIndex DisplayIndex

取得或設定相對於目前所顯示之資料行的資料行顯示順序。Gets or sets the display order of the column relative to the currently displayed columns.

(Inherited from DataGridViewColumn)
DividerWidth DividerWidth DividerWidth DividerWidth

取得或設定資料行分割線的寬度 (以像素為單位)。Gets or sets the width, in pixels, of the column divider.

(Inherited from DataGridViewColumn)
FillWeight FillWeight FillWeight FillWeight

取得或設定值,表示處於填入模式中的資料行寬度,相對於控制項中處於填入模式的資料行寬度。Gets or sets a value that represents the width of the column when it is in fill mode relative to the widths of other fill-mode columns in the control.

(Inherited from DataGridViewColumn)
Frozen Frozen Frozen Frozen

取得或設定值,指出當使用者水平捲動 DataGridView 控制項時,資料行是否會跟著移動。Gets or sets a value indicating whether a column will move when a user scrolls the DataGridView control horizontally.

(Inherited from DataGridViewColumn)
HasDefaultCellStyle HasDefaultCellStyle HasDefaultCellStyle HasDefaultCellStyle

取得指出是否已經設定 DefaultCellStyle 屬性的值。Gets a value indicating whether the DefaultCellStyle property has been set.

(Inherited from DataGridViewBand)
HeaderCell HeaderCell HeaderCell HeaderCell

取得或設定表示資料行行首的 DataGridViewColumnHeaderCellGets or sets the DataGridViewColumnHeaderCell that represents the column header.

(Inherited from DataGridViewColumn)
HeaderCellCore HeaderCellCore HeaderCellCore HeaderCellCore

取得或設定 DataGridViewBand 的標題儲存格。Gets or sets the header cell of the DataGridViewBand.

(Inherited from DataGridViewBand)
HeaderText HeaderText HeaderText HeaderText

取得或設定資料行行首儲存格上的標題文字。Gets or sets the caption text on the column's header cell.

(Inherited from DataGridViewColumn)
Index Index Index Index

取得 DataGridView 控制項內群組列的相對位置。Gets the relative position of the band within the DataGridView control.

(Inherited from DataGridViewBand)
InheritedAutoSizeMode InheritedAutoSizeMode InheritedAutoSizeMode InheritedAutoSizeMode

取得資料行的作用中調整大小模式。Gets the sizing mode in effect for the column.

(Inherited from DataGridViewColumn)
InheritedStyle InheritedStyle InheritedStyle InheritedStyle

取得目前套用至資料行的儲存格樣式。Gets the cell style currently applied to the column.

(Inherited from DataGridViewColumn)
IsDataBound IsDataBound IsDataBound IsDataBound

取得值指出資料行是否繫結至資料來源。Gets a value indicating whether the column is bound to a data source.

(Inherited from DataGridViewColumn)
IsRow IsRow IsRow IsRow

取得值,指出群組列是否表示資料列。Gets a value indicating whether the band represents a row.

(Inherited from DataGridViewBand)
MaxInputLength MaxInputLength MaxInputLength MaxInputLength

取得或設定可輸入文字方塊中的最大字元數。Gets or sets the maximum number of characters that can be entered into the text box.

MinimumWidth MinimumWidth MinimumWidth MinimumWidth

取得或設定資料行的最小寬度 (以像素為單位)。Gets or sets the minimum width, in pixels, of the column.

(Inherited from DataGridViewColumn)
Name Name Name Name

取得或設定資料行的名稱。Gets or sets the name of the column.

(Inherited from DataGridViewColumn)
ReadOnly ReadOnly ReadOnly ReadOnly

取得或設定值,指出使用者是否可以編輯資料行的儲存格。Gets or sets a value indicating whether the user can edit the column's cells.

(Inherited from DataGridViewColumn)
Resizable Resizable Resizable Resizable

取得或設定值,指出資料行是否可以重新調整大小。Gets or sets a value indicating whether the column is resizable.

(Inherited from DataGridViewColumn)
Selected Selected Selected Selected

取得或設定值,指出群組列是否位於已選取的使用者介面 (UI) 狀態下。Gets or sets a value indicating whether the band is in a selected user interface (UI) state.

(Inherited from DataGridViewBand)
Site Site Site Site

取得或設定資料行的站台。Gets or sets the site of the column.

(Inherited from DataGridViewColumn)
SortMode SortMode SortMode SortMode

取得或設定資料行的排序模式。Gets or sets the sort mode for the column.

State State State State

取得此項目的使用者介面 (UI) 狀態。Gets the user interface (UI) state of the element.

(Inherited from DataGridViewElement)
Tag Tag Tag Tag

取得或設定物件,其中包含與群組列相關的資料。Gets or sets the object that contains data to associate with the band.

(Inherited from DataGridViewBand)
ToolTipText ToolTipText ToolTipText ToolTipText

取得或設定供工具提示使用的文字。Gets or sets the text used for ToolTips.

(Inherited from DataGridViewColumn)
ValueType ValueType ValueType ValueType

取得或設定資枓行儲存格中的值之資料型別。Gets or sets the data type of the values in the column's cells.

(Inherited from DataGridViewColumn)
Visible Visible Visible Visible

取得或設定值,指出資料行是否為可見。Gets or sets a value indicating whether the column is visible.

(Inherited from DataGridViewColumn)
Width Width Width Width

取得或設定目前的資料行寬度。Gets or sets the current width of the column.

(Inherited from DataGridViewColumn)

方法

Clone() Clone() Clone() Clone()

建立與這個群組列完全相同的複本。Creates an exact copy of this band.

(Inherited from DataGridViewColumn)
Dispose() Dispose() Dispose() Dispose()

釋放 DataGridViewBand 所使用的所有資源。Releases all resources used by the DataGridViewBand.

(Inherited from DataGridViewBand)
Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

釋放 DataGridViewBand 所使用的 Unmanaged 資源,並選擇性地釋放 Managed 資源。Releases the unmanaged resources used by the DataGridViewBand and optionally releases the managed resources.

(Inherited from DataGridViewColumn)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetPreferredWidth(DataGridViewAutoSizeColumnMode, Boolean) GetPreferredWidth(DataGridViewAutoSizeColumnMode, Boolean) GetPreferredWidth(DataGridViewAutoSizeColumnMode, Boolean) GetPreferredWidth(DataGridViewAutoSizeColumnMode, Boolean)

根據指定的準則,計算資料行的理想寬度。Calculates the ideal width of the column based on the specified criteria.

(Inherited from DataGridViewColumn)
GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
OnDataGridViewChanged() OnDataGridViewChanged() OnDataGridViewChanged() OnDataGridViewChanged()

當群組列與不同的 DataGridView 產生關聯時呼叫。Called when the band is associated with a different DataGridView.

(Inherited from DataGridViewBand)
RaiseCellClick(DataGridViewCellEventArgs) RaiseCellClick(DataGridViewCellEventArgs) RaiseCellClick(DataGridViewCellEventArgs) RaiseCellClick(DataGridViewCellEventArgs)

引發 CellClick 事件。Raises the CellClick event.

(Inherited from DataGridViewElement)
RaiseCellContentClick(DataGridViewCellEventArgs) RaiseCellContentClick(DataGridViewCellEventArgs) RaiseCellContentClick(DataGridViewCellEventArgs) RaiseCellContentClick(DataGridViewCellEventArgs)

引發 CellContentClick 事件。Raises the CellContentClick event.

(Inherited from DataGridViewElement)
RaiseCellContentDoubleClick(DataGridViewCellEventArgs) RaiseCellContentDoubleClick(DataGridViewCellEventArgs) RaiseCellContentDoubleClick(DataGridViewCellEventArgs) RaiseCellContentDoubleClick(DataGridViewCellEventArgs)

引發 CellContentDoubleClick 事件。Raises the CellContentDoubleClick event.

(Inherited from DataGridViewElement)
RaiseCellValueChanged(DataGridViewCellEventArgs) RaiseCellValueChanged(DataGridViewCellEventArgs) RaiseCellValueChanged(DataGridViewCellEventArgs) RaiseCellValueChanged(DataGridViewCellEventArgs)

引發 CellValueChanged 事件。Raises the CellValueChanged event.

(Inherited from DataGridViewElement)
RaiseDataError(DataGridViewDataErrorEventArgs) RaiseDataError(DataGridViewDataErrorEventArgs) RaiseDataError(DataGridViewDataErrorEventArgs) RaiseDataError(DataGridViewDataErrorEventArgs)

引發 DataError 事件。Raises the DataError event.

(Inherited from DataGridViewElement)
RaiseMouseWheel(MouseEventArgs) RaiseMouseWheel(MouseEventArgs) RaiseMouseWheel(MouseEventArgs) RaiseMouseWheel(MouseEventArgs)

引發 MouseWheel 事件。Raises the MouseWheel event.

(Inherited from DataGridViewElement)
ToString() ToString() ToString() ToString()

取得描述資料行的字串。Gets a string that describes the column.

事件

Disposed Disposed Disposed Disposed

發生於處置 (Dispose) DataGridViewColumn 時。Occurs when the DataGridViewColumn is disposed.

(Inherited from DataGridViewColumn)

適用於

另請參閱