DataGridViewCell.GetInheritedState(Int32) 方法

定義

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

public:
 virtual System::Windows::Forms::DataGridViewElementStates GetInheritedState(int rowIndex);
public virtual System.Windows.Forms.DataGridViewElementStates GetInheritedState (int rowIndex);
abstract member GetInheritedState : int -> System.Windows.Forms.DataGridViewElementStates
override this.GetInheritedState : int -> System.Windows.Forms.DataGridViewElementStates
Public Overridable Function GetInheritedState (rowIndex As Integer) As DataGridViewElementStates

參數

rowIndex
Int32

包含儲存格的資料列之索引。The index of the row containing the cell.

傳回

DataGridViewElementStates

DataGridViewElementStates 值的位元 (Bitwise) 組合,表示儲存格的目前狀態。A bitwise combination of DataGridViewElementStates values representing the current state of the cell.

例外狀況

儲存格不包含於 DataGridView 控制項之中,而 rowIndex 不是 -1。The cell is not contained within a DataGridView control and rowIndex is not -1.

-或--or- rowIndex 不是包含這個儲存格之資料列的索引。rowIndex is not the index of the row containing this cell.

儲存格包含在 DataGridView 控制項內,且 rowIndex 位於有效範圍之外,有效範圍是從 0 到控制項的資料列數減 1。The cell is contained within a DataGridView control and rowIndex is outside the valid range of 0 to the number of rows in the control minus 1.

備註

這個方法很適合用來判斷共用資料列中的資料格狀態。This method is useful to determine the state of a cell in a shared row. 共用資料列 Index 的值為-1,這可防止您在 InheritedState 共用資料列中使用屬性與儲存格。Shared rows have Index values of -1, which prevents you from using the InheritedState property with cells in shared rows. 若要使用這個方法,請傳入包含這個儲存格的資料列之實際索引。To use this method, pass in the actual index of the row containing this cell. 您可以藉由呼叫方法來取出共用資料列的實際索引 IndexOfYou can retrieve the actual index of a shared row by calling the IndexOf method.

適用於

另請參閱