DataGridViewCell.HasStyle DataGridViewCell.HasStyle DataGridViewCell.HasStyle DataGridViewCell.HasStyle Property

定義

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

public:
 property bool HasStyle { bool get(); };
[System.ComponentModel.Browsable(false)]
public bool HasStyle { get; }
member this.HasStyle : bool
Public ReadOnly Property HasStyle As Boolean

屬性值

如果 Style 屬性已經設定,則為 true,否則為 falsetrue if the Style property has been set; otherwise, false.

備註

如果先前尚未存取屬性Style ,則取得屬性的DataGridViewCellStyle值會自動具現化新的。Getting the value of the Style property automatically instantiates a new DataGridViewCellStyle if the property has not previously been accessed. 因此,您必須使用HasStyle屬性來判斷Style屬性目前是否設定為DataGridViewCellStyle實例。Therefore, you must use the HasStyle property to determine whether the Style property is currently set to a DataGridViewCellStyle instance. 這適用于判斷InheritedStyle屬性所傳回之物件的哪些屬性代表專為儲存格所設定的樣式。This is useful to determine which properties of the object returned by the InheritedStyle property represent styles set specifically for the cell.

如需有關儲存格樣式繼承的詳細資訊,請參閱Windows Forms DataGridView 控制項中的儲存格樣式For more information about cell style inheritance, see Cell Styles in the Windows Forms DataGridView Control.

適用於

另請參閱