DataGridViewCell.GetInheritedState(Int32) 方法

定義

傳回值,指出儲存格的目前狀態是從其資料列和資料行的狀態繼承而來。

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

包含儲存格的資料列之索引。

傳回

DataGridViewElementStates

DataGridViewElementStates 值的位元 (Bitwise) 組合,表示儲存格的目前狀態。

例外狀況

儲存格不包含於 DataGridView 控制項之中,而 rowIndex 不是 -1。

-或- rowIndex 不是包含這個儲存格之資料列的索引。

儲存格包含在 DataGridView 控制項內,且 rowIndex 位於有效範圍之外,有效範圍是從 0 到控制項的資料列數減 1。

備註

這個方法有助於判斷共用資料列中儲存格的狀態。 共用資料列的 Index 值為 -1,這可防止您將 屬性與共享資料列中的儲存格搭配使用 InheritedState 。 若要使用這個方法,請傳入包含此儲存格之資料列的實際索引。 您可以呼叫 IndexOf 方法來擷取共用資料列的實際索引。

適用於

另請參閱