DataGridViewCell DataGridViewCell DataGridViewCell DataGridViewCell Class

定義

表示 DataGridView 控制項中的個別儲存格。Represents an individual cell in a DataGridView control.

public ref class DataGridViewCell abstract : System::Windows::Forms::DataGridViewElement, ICloneable, IDisposable
[System.ComponentModel.TypeConverter(typeof(System.Windows.Forms.DataGridViewCellConverter))]
public abstract class DataGridViewCell : System.Windows.Forms.DataGridViewElement, ICloneable, IDisposable
type DataGridViewCell = class
    inherit DataGridViewElement
    interface ICloneable
    interface IDisposable
Public MustInherit Class DataGridViewCell
Inherits DataGridViewElement
Implements ICloneable, IDisposable
繼承
衍生
屬性
實作

範例

下列程式碼範例說明如何使用這個型別。The following code example illustrates the use of this type. 如需有關此範例的詳細資訊,請參閱How to:Windows 中的個別資料格的工具提示 Form DataGridView 控制項中加入For more information about this example, see How to: Add ToolTips to Individual Cells in a Windows Forms DataGridView Control.

// Sets the ToolTip text for cells in the Rating column.
void dataGridView1_CellFormatting(Object^ /*sender*/, 
    DataGridViewCellFormattingEventArgs^ e)
{
    if ( (e->ColumnIndex == this->dataGridView1->Columns["Rating"]->Index)
        && e->Value != nullptr )
    {
        DataGridViewCell^ cell = 
            this->dataGridView1->Rows[e->RowIndex]->Cells[e->ColumnIndex];
        if (e->Value->Equals("*"))
        {                
            cell->ToolTipText = "very bad";
        }
        else if (e->Value->Equals("**"))
        {
            cell->ToolTipText = "bad";
        }
        else if (e->Value->Equals("***"))
        {
            cell->ToolTipText = "good";
        }
        else if (e->Value->Equals("****"))
        {
            cell->ToolTipText = "very good";
        }
    }
}
// Sets the ToolTip text for cells in the Rating column.
void dataGridView1_CellFormatting(object sender, 
    DataGridViewCellFormattingEventArgs e)
{
    if ( (e.ColumnIndex == this.dataGridView1.Columns["Rating"].Index)
        && e.Value != null )
    {
        DataGridViewCell cell = 
            this.dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
        if (e.Value.Equals("*"))
        {                
            cell.ToolTipText = "very bad";
        }
        else if (e.Value.Equals("**"))
        {
            cell.ToolTipText = "bad";
        }
        else if (e.Value.Equals("***"))
        {
            cell.ToolTipText = "good";
        }
        else if (e.Value.Equals("****"))
        {
            cell.ToolTipText = "very good";
        }
    }
}
' Sets the ToolTip text for cells in the Rating column.
Sub dataGridView1_CellFormatting(ByVal sender As Object, _
    ByVal e As DataGridViewCellFormattingEventArgs) _
    Handles dataGridView1.CellFormatting

    If e.ColumnIndex = Me.dataGridView1.Columns("Rating").Index _
        AndAlso (e.Value IsNot Nothing) Then

        With Me.dataGridView1.Rows(e.RowIndex).Cells(e.ColumnIndex)

            If e.Value.Equals("*") Then
                .ToolTipText = "very bad"
            ElseIf e.Value.Equals("**") Then
                .ToolTipText = "bad"
            ElseIf e.Value.Equals("***") Then
                .ToolTipText = "good"
            ElseIf e.Value.Equals("****") Then
                .ToolTipText = "very good"
            End If

        End With

    End If

End Sub 'dataGridView1_CellFormatting

備註

DataGridViewCell類別表示中的個別資料格DataGridView控制項。The DataGridViewCell class represents an individual cell in a DataGridView control. 您可以擷取到的資料格Cells的集合DataGridViewRowYou can retrieve cells through the Cells collection of a DataGridViewRow.

資料列和資料行DataGridViewCell識別中的儲存格的位置DataGridViewThe row and column for a DataGridViewCell identify the cell's location in the DataGridView. 典型的資料格都包含特定的資料列和資料行包含資料。A typical cell contains data specific to the row and column in which it is contained. 儲存格可以自訂數種方式,藉由設定其屬性,處理與它相關聯的事件。The cell can be customized in a number of ways by setting its properties and handling the events associated with it.

給繼承者的注意事項

當您衍生自DataGridViewCell並將新屬性加入至衍生的類別,請務必覆寫Clone()方法,以便於複製作業期間複製新屬性。When you derive from DataGridViewCell 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.

建構函式

DataGridViewCell() DataGridViewCell() DataGridViewCell() DataGridViewCell()

初始化 DataGridViewCell 類別的新執行個體。Initializes a new instance of the DataGridViewCell class.

屬性

AccessibilityObject AccessibilityObject AccessibilityObject AccessibilityObject

取得指定給 DataGridViewCell.DataGridViewCellAccessibleObjectDataGridViewCellGets the DataGridViewCell.DataGridViewCellAccessibleObject assigned to the DataGridViewCell.

ColumnIndex ColumnIndex ColumnIndex ColumnIndex

取得這個儲存格的資料行索引。Gets the column index for this cell.

ContentBounds ContentBounds ContentBounds ContentBounds

取得圍住儲存格內容區域的周框。Gets the bounding rectangle that encloses the cell's content area.

ContextMenuStrip ContextMenuStrip ContextMenuStrip ContextMenuStrip

取得或設定與儲存格相關聯的捷徑功能表。Gets or sets the shortcut menu associated with the cell.

DataGridView DataGridView DataGridView DataGridView

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

(Inherited from DataGridViewElement)
DefaultNewRowValue DefaultNewRowValue DefaultNewRowValue DefaultNewRowValue

取得新資料錄之資料列中儲存格的預設值。Gets the default value for a cell in the row for new records.

Displayed Displayed Displayed Displayed

取得指出儲存格目前是否顯示於螢幕上的值。Gets a value that indicates whether the cell is currently displayed on-screen.

EditedFormattedValue EditedFormattedValue EditedFormattedValue EditedFormattedValue

取得目前已格式化的儲存格值,不管儲存格是否處於編輯模式,而值是否尚未認可。Gets the current, formatted value of the cell, regardless of whether the cell is in edit mode and the value has not been committed.

EditType EditType EditType EditType

取得儲存格的裝載編輯控制項型別。Gets the type of the cell's hosted editing control.

ErrorIconBounds ErrorIconBounds ErrorIconBounds ErrorIconBounds

取得儲存格之錯誤圖示的界限。Gets the bounds of the error icon for the cell.

ErrorText ErrorText ErrorText ErrorText

取得或設定文字,描述與儲存格相關聯的錯誤狀況。Gets or sets the text describing an error condition associated with the cell.

FormattedValue FormattedValue FormattedValue FormattedValue

取得儲存格的格式化值,以供顯示。Gets the value of the cell as formatted for display.

FormattedValueType FormattedValueType FormattedValueType FormattedValueType

取得與儲存格相關的格式化值的型別。Gets the type of the formatted value associated with the cell.

Frozen Frozen Frozen Frozen

取得指出是否已凍結此儲存格的值。Gets a value indicating whether the cell is frozen.

HasStyle HasStyle HasStyle HasStyle

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

InheritedState InheritedState InheritedState InheritedState

取得儲存格的目前狀態,是繼承其資料列和資料行的狀態。Gets the current state of the cell as inherited from the state of its row and column.

InheritedStyle InheritedStyle InheritedStyle InheritedStyle

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

IsInEditMode IsInEditMode IsInEditMode IsInEditMode

取得指出目前是否正在編輯這個儲存格的值。Gets a value indicating whether this cell is currently being edited.

OwningColumn OwningColumn OwningColumn OwningColumn

取得包含這個儲存格的資料行。Gets the column that contains this cell.

OwningRow OwningRow OwningRow OwningRow

取得包含這個儲存格的資料列。Gets the row that contains this cell.

PreferredSize PreferredSize PreferredSize PreferredSize

取得能夠容納儲存格的矩形區域大小 (以像素為單位)。Gets the size, in pixels, of a rectangular area into which the cell can fit.

ReadOnly ReadOnly ReadOnly ReadOnly

取得或設定值,指出是否可以編輯儲存格的資料。Gets or sets a value indicating whether the cell's data can be edited.

Resizable Resizable Resizable Resizable

取得指出儲存格是否可以調整大小的值。Gets a value indicating whether the cell can be resized.

RowIndex RowIndex RowIndex RowIndex

取得儲存格的父資料列索引。Gets the index of the cell's parent row.

Selected Selected Selected Selected

取得或設定值,指出是否已選取此儲存格。Gets or sets a value indicating whether the cell has been selected.

Size Size Size Size

取得儲存格的大小。Gets the size of the cell.

State State State State

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

(Inherited from DataGridViewElement)
Style Style Style Style

取得或設定儲存格的樣式。Gets or sets the style for the cell.

Tag Tag Tag Tag

取得或設定物件,其中包含儲存格的相關補充資料。Gets or sets the object that contains supplemental data about the cell.

ToolTipText ToolTipText ToolTipText ToolTipText

取得或設定與這個儲存格相關聯的工具提示文字。Gets or sets the ToolTip text associated with this cell.

Value Value Value Value

取得或設定與這個儲存格相關聯的值。Gets or sets the value associated with this cell.

ValueType ValueType ValueType ValueType

取得或設定儲存格中值的資料型別。Gets or sets the data type of the values in the cell.

Visible Visible Visible Visible

取得指出儲存格是在已隱藏資料列或是資料行中的值。Gets a value indicating whether the cell is in a row or column that has been hidden.

方法

AdjustCellBorderStyle(DataGridViewAdvancedBorderStyle, DataGridViewAdvancedBorderStyle, Boolean, Boolean, Boolean, Boolean) AdjustCellBorderStyle(DataGridViewAdvancedBorderStyle, DataGridViewAdvancedBorderStyle, Boolean, Boolean, Boolean, Boolean) AdjustCellBorderStyle(DataGridViewAdvancedBorderStyle, DataGridViewAdvancedBorderStyle, Boolean, Boolean, Boolean, Boolean) AdjustCellBorderStyle(DataGridViewAdvancedBorderStyle, DataGridViewAdvancedBorderStyle, Boolean, Boolean, Boolean, Boolean)

根據指定的準則,修改輸入儲存格框線樣式。Modifies the input cell border style according to the specified criteria.

BorderWidths(DataGridViewAdvancedBorderStyle) BorderWidths(DataGridViewAdvancedBorderStyle) BorderWidths(DataGridViewAdvancedBorderStyle) BorderWidths(DataGridViewAdvancedBorderStyle)

傳回 Rectangle,表示所有儲存格邊界的寬度。Returns a Rectangle that represents the widths of all the cell margins.

ClickUnsharesRow(DataGridViewCellEventArgs) ClickUnsharesRow(DataGridViewCellEventArgs) ClickUnsharesRow(DataGridViewCellEventArgs) ClickUnsharesRow(DataGridViewCellEventArgs)

指出當按下儲存格時,儲存格的資料列是否會取消共用。Indicates whether the cell's row will be unshared when the cell is clicked.

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

建立與這個儲存格完全相同的複本。Creates an exact copy of this cell.

ContentClickUnsharesRow(DataGridViewCellEventArgs) ContentClickUnsharesRow(DataGridViewCellEventArgs) ContentClickUnsharesRow(DataGridViewCellEventArgs) ContentClickUnsharesRow(DataGridViewCellEventArgs)

指出當按下儲存格內容時,儲存格的資料列是否會取消共用。Indicates whether the cell's row will be unshared when the cell's content is clicked.

ContentDoubleClickUnsharesRow(DataGridViewCellEventArgs) ContentDoubleClickUnsharesRow(DataGridViewCellEventArgs) ContentDoubleClickUnsharesRow(DataGridViewCellEventArgs) ContentDoubleClickUnsharesRow(DataGridViewCellEventArgs)

指出當按兩下儲存格內容時,儲存格的資料列是否會取消共用。Indicates whether the cell's row will be unshared when the cell's content is double-clicked.

CreateAccessibilityInstance() CreateAccessibilityInstance() CreateAccessibilityInstance() CreateAccessibilityInstance()

DataGridViewCell 建立新的可存取物件。Creates a new accessible object for the DataGridViewCell.

DetachEditingControl() DetachEditingControl() DetachEditingControl() DetachEditingControl()

DataGridView 中移除儲存格的編輯控制項。Removes the cell's editing control from the DataGridView.

Dispose() Dispose() Dispose() Dispose()

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

Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)

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

DoubleClickUnsharesRow(DataGridViewCellEventArgs) DoubleClickUnsharesRow(DataGridViewCellEventArgs) DoubleClickUnsharesRow(DataGridViewCellEventArgs) DoubleClickUnsharesRow(DataGridViewCellEventArgs)

指出當按兩下儲存格時,儲存格的資料列是否會取消共用。Indicates whether the cell's row will be unshared when the cell is double-clicked.

EnterUnsharesRow(Int32, Boolean) EnterUnsharesRow(Int32, Boolean) EnterUnsharesRow(Int32, Boolean) EnterUnsharesRow(Int32, Boolean)

指出當焦點移至儲存格時,是否將取消共用父資料列。Indicates whether the parent row will be unshared when the focus moves to the cell.

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
Finalize() Finalize() Finalize() Finalize()

在記憶體回收 DataGridViewCell 之前釋放 Unmanaged 資源並執行其他的清除作業。Releases the unmanaged resources and performs other cleanup operations before the DataGridViewCell is reclaimed by garbage collection.

GetClipboardContent(Int32, Boolean, Boolean, Boolean, Boolean, String) GetClipboardContent(Int32, Boolean, Boolean, Boolean, Boolean, String) GetClipboardContent(Int32, Boolean, Boolean, Boolean, Boolean, String) GetClipboardContent(Int32, Boolean, Boolean, Boolean, Boolean, String)

擷取儲存格的已格式化的值,以複製到 ClipboardRetrieves the formatted value of the cell to copy to the Clipboard.

GetContentBounds(Graphics, DataGridViewCellStyle, Int32) GetContentBounds(Graphics, DataGridViewCellStyle, Int32) GetContentBounds(Graphics, DataGridViewCellStyle, Int32) GetContentBounds(Graphics, DataGridViewCellStyle, Int32)

傳回圍住儲存格內容區域的周框,此內容區域是使用指定的 Graphics 和儲存格樣式所計算。Returns the bounding rectangle that encloses the cell's content area, which is calculated using the specified Graphics and cell style.

GetContentBounds(Int32) GetContentBounds(Int32) GetContentBounds(Int32) GetContentBounds(Int32)

使用預設的 Graphics 和目前儲存格中所採用的儲存格樣式,傳回圍住儲存格內容區域的周框。Returns the bounding rectangle that encloses the cell's content area using a default Graphics and cell style currently in effect for the cell.

GetEditedFormattedValue(Int32, DataGridViewDataErrorContexts) GetEditedFormattedValue(Int32, DataGridViewDataErrorContexts) GetEditedFormattedValue(Int32, DataGridViewDataErrorContexts) GetEditedFormattedValue(Int32, DataGridViewDataErrorContexts)

傳回目前已格式化的儲存格值,不管儲存格是否處於編輯模式,而值是否尚未認可。Returns the current, formatted value of the cell, regardless of whether the cell is in edit mode and the value has not been committed.

GetErrorIconBounds(Graphics, DataGridViewCellStyle, Int32) GetErrorIconBounds(Graphics, DataGridViewCellStyle, Int32) GetErrorIconBounds(Graphics, DataGridViewCellStyle, Int32) GetErrorIconBounds(Graphics, DataGridViewCellStyle, Int32)

傳回圍住儲存格的錯誤圖示之週框 (如果有此圖示)。Returns the bounding rectangle that encloses the cell's error icon, if one is displayed.

GetErrorText(Int32) GetErrorText(Int32) GetErrorText(Int32) GetErrorText(Int32)

傳回表示儲存格錯誤的字串。Returns a string that represents the error for the cell.

GetFormattedValue(Object, Int32, DataGridViewCellStyle, TypeConverter, TypeConverter, DataGridViewDataErrorContexts) GetFormattedValue(Object, Int32, DataGridViewCellStyle, TypeConverter, TypeConverter, DataGridViewDataErrorContexts) GetFormattedValue(Object, Int32, DataGridViewCellStyle, TypeConverter, TypeConverter, DataGridViewDataErrorContexts) GetFormattedValue(Object, Int32, DataGridViewCellStyle, TypeConverter, TypeConverter, DataGridViewDataErrorContexts)

取得儲存格的格式化值,以供顯示。Gets the value of the cell as formatted for display.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

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

(Inherited from Object)
GetInheritedContextMenuStrip(Int32) GetInheritedContextMenuStrip(Int32) GetInheritedContextMenuStrip(Int32) GetInheritedContextMenuStrip(Int32)

取得目前儲存格的繼承捷徑功能表。Gets the inherited shortcut menu for the current cell.

GetInheritedState(Int32) GetInheritedState(Int32) GetInheritedState(Int32) GetInheritedState(Int32)

傳回值,指出儲存格的目前狀態是從其資料列和資料行的狀態繼承而來。Returns a value indicating the current state of the cell as inherited from the state of its row and column.

GetInheritedStyle(DataGridViewCellStyle, Int32, Boolean) GetInheritedStyle(DataGridViewCellStyle, Int32, Boolean) GetInheritedStyle(DataGridViewCellStyle, Int32, Boolean) GetInheritedStyle(DataGridViewCellStyle, Int32, Boolean)

取得套用到儲存格的樣式。Gets the style applied to the cell.

GetPreferredSize(Graphics, DataGridViewCellStyle, Int32, Size) GetPreferredSize(Graphics, DataGridViewCellStyle, Int32, Size) GetPreferredSize(Graphics, DataGridViewCellStyle, Int32, Size) GetPreferredSize(Graphics, DataGridViewCellStyle, Int32, Size)

計算儲存格的慣用大小 (以像素為單位)。Calculates the preferred size, in pixels, of the cell.

GetSize(Int32) GetSize(Int32) GetSize(Int32) GetSize(Int32)

取得儲存格的大小。Gets the size of the cell.

GetType() GetType() GetType() GetType()

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

(Inherited from Object)
GetValue(Int32) GetValue(Int32) GetValue(Int32) GetValue(Int32)

取得儲存格的值。Gets the value of the cell.

InitializeEditingControl(Int32, Object, DataGridViewCellStyle) InitializeEditingControl(Int32, Object, DataGridViewCellStyle) InitializeEditingControl(Int32, Object, DataGridViewCellStyle) InitializeEditingControl(Int32, Object, DataGridViewCellStyle)

初始化用來編輯儲存格的控制項。Initializes the control used to edit the cell.

KeyDownUnsharesRow(KeyEventArgs, Int32) KeyDownUnsharesRow(KeyEventArgs, Int32) KeyDownUnsharesRow(KeyEventArgs, Int32) KeyDownUnsharesRow(KeyEventArgs, Int32)

指出當焦點在儲存格上,而使用者按下按鍵時,是否取消共用父資料列。Indicates whether the parent row is unshared if the user presses a key while the focus is on the cell.

KeyEntersEditMode(KeyEventArgs) KeyEntersEditMode(KeyEventArgs) KeyEntersEditMode(KeyEventArgs) KeyEntersEditMode(KeyEventArgs)

判斷是否應該根據指定的按鍵啟動編輯模式。Determines if edit mode should be started based on the given key.

KeyPressUnsharesRow(KeyPressEventArgs, Int32) KeyPressUnsharesRow(KeyPressEventArgs, Int32) KeyPressUnsharesRow(KeyPressEventArgs, Int32) KeyPressUnsharesRow(KeyPressEventArgs, Int32)

指出在資料列中的儲存格具有焦點時,如果按下按鍵,資料列是否將進行取消共用。Indicates whether a row will be unshared if a key is pressed while a cell in the row has focus.

KeyUpUnsharesRow(KeyEventArgs, Int32) KeyUpUnsharesRow(KeyEventArgs, Int32) KeyUpUnsharesRow(KeyEventArgs, Int32) KeyUpUnsharesRow(KeyEventArgs, Int32)

指出當焦點在儲存格上,而使用者釋放按鍵時,是否取消共用父資料列。Indicates whether the parent row is unshared when the user releases a key while the focus is on the cell.

LeaveUnsharesRow(Int32, Boolean) LeaveUnsharesRow(Int32, Boolean) LeaveUnsharesRow(Int32, Boolean) LeaveUnsharesRow(Int32, Boolean)

指出當焦點移出資料列中的儲存格時,是否取消共用該資料列。Indicates whether a row will be unshared when the focus leaves a cell in the row.

MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags) MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags) MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags) MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags)

在指定的特性下,取得所指定文字的高度 (以像素為單位)。Gets the height, in pixels, of the specified text, given the specified characteristics.

MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags, Boolean) MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags, Boolean) MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags, Boolean) MeasureTextHeight(Graphics, String, Font, Int32, TextFormatFlags, Boolean)

在指定的特性下,取得所指定文字的高度 (以像素為單位)。Gets the height, in pixels, of the specified text, given the specified characteristics. 而且也指出所需要的寬度是否大於指定的最大寬度。Also indicates whether the required width is greater than the specified maximum width.

MeasureTextPreferredSize(Graphics, String, Font, Single, TextFormatFlags) MeasureTextPreferredSize(Graphics, String, Font, Single, TextFormatFlags) MeasureTextPreferredSize(Graphics, String, Font, Single, TextFormatFlags) MeasureTextPreferredSize(Graphics, String, Font, Single, TextFormatFlags)

在指定的特性下,取得所指定文字的理想高度和寬度。Gets the ideal height and width of the specified text given the specified characteristics.

MeasureTextSize(Graphics, String, Font, TextFormatFlags) MeasureTextSize(Graphics, String, Font, TextFormatFlags) MeasureTextSize(Graphics, String, Font, TextFormatFlags) MeasureTextSize(Graphics, String, Font, TextFormatFlags)

在指定的特性下,取得所指定文字的高度和寬度。Gets the height and width of the specified text given the specified characteristics.

MeasureTextWidth(Graphics, String, Font, Int32, TextFormatFlags) MeasureTextWidth(Graphics, String, Font, Int32, TextFormatFlags) MeasureTextWidth(Graphics, String, Font, Int32, TextFormatFlags) MeasureTextWidth(Graphics, String, Font, Int32, TextFormatFlags)

在指定的特性下,取得所指定文字的寬度 (以像素為單位)。Gets the width, in pixels, of the specified text given the specified characteristics.

MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

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

(Inherited from Object)
MouseClickUnsharesRow(DataGridViewCellMouseEventArgs) MouseClickUnsharesRow(DataGridViewCellMouseEventArgs) MouseClickUnsharesRow(DataGridViewCellMouseEventArgs) MouseClickUnsharesRow(DataGridViewCellMouseEventArgs)

指出當指標在資料列的儲存格上,而使用者按一下滑鼠按鈕時,該資料列是否取消共用。Indicates whether a row will be unshared if the user clicks a mouse button while the pointer is on a cell in the row.

MouseDoubleClickUnsharesRow(DataGridViewCellMouseEventArgs) MouseDoubleClickUnsharesRow(DataGridViewCellMouseEventArgs) MouseDoubleClickUnsharesRow(DataGridViewCellMouseEventArgs) MouseDoubleClickUnsharesRow(DataGridViewCellMouseEventArgs)

指出當使用者按兩下資料列中的儲存格時,是否取消共用該資料列。Indicates whether a row will be unshared if the user double-clicks a cell in the row.

MouseDownUnsharesRow(DataGridViewCellMouseEventArgs) MouseDownUnsharesRow(DataGridViewCellMouseEventArgs) MouseDownUnsharesRow(DataGridViewCellMouseEventArgs) MouseDownUnsharesRow(DataGridViewCellMouseEventArgs)

指出當指標在資料列的儲存格上,而按住滑鼠按鈕時,該資料列是否取消共用。Indicates whether a row will be unshared when the user holds down a mouse button while the pointer is on a cell in the row.

MouseEnterUnsharesRow(Int32) MouseEnterUnsharesRow(Int32) MouseEnterUnsharesRow(Int32) MouseEnterUnsharesRow(Int32)

指出當滑鼠指標移到某資料列的儲存格上方時,是否取消共用該資料列。Indicates whether a row will be unshared when the mouse pointer moves over a cell in the row.

MouseLeaveUnsharesRow(Int32) MouseLeaveUnsharesRow(Int32) MouseLeaveUnsharesRow(Int32) MouseLeaveUnsharesRow(Int32)

指示當滑鼠指標離開某列時,該列是否共用。Indicates whether a row will be unshared when the mouse pointer leaves the row.

MouseMoveUnsharesRow(DataGridViewCellMouseEventArgs) MouseMoveUnsharesRow(DataGridViewCellMouseEventArgs) MouseMoveUnsharesRow(DataGridViewCellMouseEventArgs) MouseMoveUnsharesRow(DataGridViewCellMouseEventArgs)

指出當滑鼠指標移到某資料列的儲存格上方時,是否取消共用該資料列。Indicates whether a row will be unshared when the mouse pointer moves over a cell in the row.

MouseUpUnsharesRow(DataGridViewCellMouseEventArgs) MouseUpUnsharesRow(DataGridViewCellMouseEventArgs) MouseUpUnsharesRow(DataGridViewCellMouseEventArgs) MouseUpUnsharesRow(DataGridViewCellMouseEventArgs)

指出當指標在資料列的儲存格上,而使用者釋放滑鼠按鈕時,該資料列是否取消共用。Indicates whether a row will be unshared when the user releases a mouse button while the pointer is on a cell in the row.

OnClick(DataGridViewCellEventArgs) OnClick(DataGridViewCellEventArgs) OnClick(DataGridViewCellEventArgs) OnClick(DataGridViewCellEventArgs)

當按下儲存格時呼叫。Called when the cell is clicked.

OnContentClick(DataGridViewCellEventArgs) OnContentClick(DataGridViewCellEventArgs) OnContentClick(DataGridViewCellEventArgs) OnContentClick(DataGridViewCellEventArgs)

當按下儲存格內容時呼叫。Called when the cell's contents are clicked.

OnContentDoubleClick(DataGridViewCellEventArgs) OnContentDoubleClick(DataGridViewCellEventArgs) OnContentDoubleClick(DataGridViewCellEventArgs) OnContentDoubleClick(DataGridViewCellEventArgs)

當按兩下儲存格內容時呼叫。Called when the cell's contents are double-clicked.

OnDataGridViewChanged() OnDataGridViewChanged() OnDataGridViewChanged() OnDataGridViewChanged()

當儲存格的 DataGridView 屬性變更時呼叫。Called when the DataGridView property of the cell changes.

OnDoubleClick(DataGridViewCellEventArgs) OnDoubleClick(DataGridViewCellEventArgs) OnDoubleClick(DataGridViewCellEventArgs) OnDoubleClick(DataGridViewCellEventArgs)

當按兩下儲存格時呼叫。Called when the cell is double-clicked.

OnEnter(Int32, Boolean) OnEnter(Int32, Boolean) OnEnter(Int32, Boolean) OnEnter(Int32, Boolean)

當焦點移至儲存格時呼叫。Called when the focus moves to a cell.

OnKeyDown(KeyEventArgs, Int32) OnKeyDown(KeyEventArgs, Int32) OnKeyDown(KeyEventArgs, Int32) OnKeyDown(KeyEventArgs, Int32)

當焦點在儲存格上,按下字元鍵時即會呼叫。Called when a character key is pressed while the focus is on a cell.

OnKeyPress(KeyPressEventArgs, Int32) OnKeyPress(KeyPressEventArgs, Int32) OnKeyPress(KeyPressEventArgs, Int32) OnKeyPress(KeyPressEventArgs, Int32)

當焦點在儲存格上,按下按鍵時呼叫。Called when a key is pressed while the focus is on a cell.

OnKeyUp(KeyEventArgs, Int32) OnKeyUp(KeyEventArgs, Int32) OnKeyUp(KeyEventArgs, Int32) OnKeyUp(KeyEventArgs, Int32)

當焦點在儲存格上,放開字元鍵時呼叫。Called when a character key is released while the focus is on a cell.

OnLeave(Int32, Boolean) OnLeave(Int32, Boolean) OnLeave(Int32, Boolean) OnLeave(Int32, Boolean)

當焦點從儲存格移動時呼叫。Called when the focus moves from a cell.

OnMouseClick(DataGridViewCellMouseEventArgs) OnMouseClick(DataGridViewCellMouseEventArgs) OnMouseClick(DataGridViewCellMouseEventArgs) OnMouseClick(DataGridViewCellMouseEventArgs)

當滑鼠指標在儲存格上,使用者按一下滑鼠按鈕時呼叫。Called when the user clicks a mouse button while the pointer is on a cell.

OnMouseDoubleClick(DataGridViewCellMouseEventArgs) OnMouseDoubleClick(DataGridViewCellMouseEventArgs) OnMouseDoubleClick(DataGridViewCellMouseEventArgs) OnMouseDoubleClick(DataGridViewCellMouseEventArgs)

當滑鼠指標在儲存格上,使用者按兩下滑鼠按鈕時呼叫。Called when the user double-clicks a mouse button while the pointer is on a cell.

OnMouseDown(DataGridViewCellMouseEventArgs) OnMouseDown(DataGridViewCellMouseEventArgs) OnMouseDown(DataGridViewCellMouseEventArgs) OnMouseDown(DataGridViewCellMouseEventArgs)

當滑鼠指標在儲存格上,使用者按住滑鼠按鈕時呼叫。Called when the user holds down a mouse button while the pointer is on a cell.

OnMouseEnter(Int32) OnMouseEnter(Int32) OnMouseEnter(Int32) OnMouseEnter(Int32)

當滑鼠指標移到儲存格上方時呼叫。Called when the mouse pointer moves over a cell.

OnMouseLeave(Int32) OnMouseLeave(Int32) OnMouseLeave(Int32) OnMouseLeave(Int32)

當滑鼠指標離開儲存格時呼叫。Called when the mouse pointer leaves the cell.

OnMouseMove(DataGridViewCellMouseEventArgs) OnMouseMove(DataGridViewCellMouseEventArgs) OnMouseMove(DataGridViewCellMouseEventArgs) OnMouseMove(DataGridViewCellMouseEventArgs)

當滑鼠指標移到儲存格內時呼叫。Called when the mouse pointer moves within a cell.

OnMouseUp(DataGridViewCellMouseEventArgs) OnMouseUp(DataGridViewCellMouseEventArgs) OnMouseUp(DataGridViewCellMouseEventArgs) OnMouseUp(DataGridViewCellMouseEventArgs)

當滑鼠指標在儲存格上,使用者釋放滑鼠按鈕時呼叫。Called when the user releases a mouse button while the pointer is on a cell.

Paint(Graphics, Rectangle, Rectangle, Int32, DataGridViewElementStates, Object, Object, String, DataGridViewCellStyle, DataGridViewAdvancedBorderStyle, DataGridViewPaintParts) Paint(Graphics, Rectangle, Rectangle, Int32, DataGridViewElementStates, Object, Object, String, DataGridViewCellStyle, DataGridViewAdvancedBorderStyle, DataGridViewPaintParts) Paint(Graphics, Rectangle, Rectangle, Int32, DataGridViewElementStates, Object, Object, String, DataGridViewCellStyle, DataGridViewAdvancedBorderStyle, DataGridViewPaintParts) Paint(Graphics, Rectangle, Rectangle, Int32, DataGridViewElementStates, Object, Object, String, DataGridViewCellStyle, DataGridViewAdvancedBorderStyle, DataGridViewPaintParts)

繪製目前的 DataGridViewCellPaints the current DataGridViewCell.

PaintBorder(Graphics, Rectangle, Rectangle, DataGridViewCellStyle, DataGridViewAdvancedBorderStyle) PaintBorder(Graphics, Rectangle, Rectangle, DataGridViewCellStyle, DataGridViewAdvancedBorderStyle) PaintBorder(Graphics, Rectangle, Rectangle, DataGridViewCellStyle, DataGridViewAdvancedBorderStyle) PaintBorder(Graphics, Rectangle, Rectangle, DataGridViewCellStyle, DataGridViewAdvancedBorderStyle)

繪製目前 DataGridViewCell 的框線。Paints the border of the current DataGridViewCell.

PaintErrorIcon(Graphics, Rectangle, Rectangle, String) PaintErrorIcon(Graphics, Rectangle, Rectangle, String) PaintErrorIcon(Graphics, Rectangle, Rectangle, String) PaintErrorIcon(Graphics, Rectangle, Rectangle, String)

繪製目前 DataGridViewCell 的錯誤圖示。Paints the error icon of the current DataGridViewCell.

ParseFormattedValue(Object, DataGridViewCellStyle, TypeConverter, TypeConverter) ParseFormattedValue(Object, DataGridViewCellStyle, TypeConverter, TypeConverter) ParseFormattedValue(Object, DataGridViewCellStyle, TypeConverter, TypeConverter) ParseFormattedValue(Object, DataGridViewCellStyle, TypeConverter, TypeConverter)

將為了顯示而格式化的值轉換成實際的儲存格值。Converts a value formatted for display to an actual cell value.

PositionEditingControl(Boolean, Boolean, Rectangle, Rectangle, DataGridViewCellStyle, Boolean, Boolean, Boolean, Boolean) PositionEditingControl(Boolean, Boolean, Rectangle, Rectangle, DataGridViewCellStyle, Boolean, Boolean, Boolean, Boolean) PositionEditingControl(Boolean, Boolean, Rectangle, Rectangle, DataGridViewCellStyle, Boolean, Boolean, Boolean, Boolean) PositionEditingControl(Boolean, Boolean, Rectangle, Rectangle, DataGridViewCellStyle, Boolean, Boolean, Boolean, Boolean)

設定由 DataGridView 控制項中的儲存格裝載之編輯控制項的位置和大小。Sets the location and size of the editing control hosted by a cell in the DataGridView control.

PositionEditingPanel(Rectangle, Rectangle, DataGridViewCellStyle, Boolean, Boolean, Boolean, Boolean) PositionEditingPanel(Rectangle, Rectangle, DataGridViewCellStyle, Boolean, Boolean, Boolean, Boolean) PositionEditingPanel(Rectangle, Rectangle, DataGridViewCellStyle, Boolean, Boolean, Boolean, Boolean) PositionEditingPanel(Rectangle, Rectangle, DataGridViewCellStyle, Boolean, Boolean, Boolean, Boolean)

設定由儲存格裝載之編輯面板的位置和大小,並傳回編輯面板中編輯控制項的標準界限。Sets the location and size of the editing panel hosted by the cell, and returns the normal bounds of the editing control within the editing panel.

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)
SetValue(Int32, Object) SetValue(Int32, Object) SetValue(Int32, Object) SetValue(Int32, Object)

設定儲存格的值。Sets the value of the cell.

ToString() ToString() ToString() ToString()

傳回描述目前物件的字串。Returns a string that describes the current object.

適用於

另請參閱