DataGridViewComboBoxColumn.DisplayStyleForCurrentCellOnly DataGridViewComboBoxColumn.DisplayStyleForCurrentCellOnly DataGridViewComboBoxColumn.DisplayStyleForCurrentCellOnly DataGridViewComboBoxColumn.DisplayStyleForCurrentCellOnly Property

定义

获取或设置一个值,该值指示当前单元格位于此列时,DisplayStyle 属性值是否只应用于 DataGridView 控件中的当前单元格。Gets or sets a value indicating whether the DisplayStyle property value applies only to the current cell in the DataGridView control when the current cell is in this column.

public:
 property bool DisplayStyleForCurrentCellOnly { bool get(); void set(bool value); };
public bool DisplayStyleForCurrentCellOnly { get; set; }
member this.DisplayStyleForCurrentCellOnly : bool with get, set
Public Property DisplayStyleForCurrentCellOnly As Boolean

属性值

如果显示样式仅应用于当前单元格,则为 true;否则为 falsetrue if the display style applies only to the current cell; otherwise false. 默认值为 falseThe default is false.

异常

注解

如果属性值为false,则该DisplayStyle属性将影响列中的所有DisplayStyle单元格; 否则,属性仅影响当前单元格。 DisplayStyleForCurrentCellOnlyIf the DisplayStyleForCurrentCellOnly property value is false, the DisplayStyle property affects all cells in the column; otherwise, the DisplayStyle property affects only the current cell.

DisplayStyle当列中的单元格不处于编辑模式时,它会影响其外观,而不管它们是否为只读。The DisplayStyle property affects the appearance of cells in the column when they are not in edit mode, and regardless of whether they are read-only. 当单元格处于编辑模式时,它将始终类似于ComboBox控件。When a cell is in edit mode, it always looks like a ComboBox control.

获取或设置此属性将获取或设置DisplayStyleForCurrentCellOnly CellTemplate由属性返回的对象的属性。Getting or setting this property gets or sets the DisplayStyleForCurrentCellOnly property of the object returned by the CellTemplate property. 设置此属性还会设置DisplayStyleForCurrentCellOnly列中每个单元格的属性,并刷新列显示。Setting this property also sets the DisplayStyleForCurrentCellOnly property of every cell in the column and refreshes the column display. 若要覆盖单个单元的指定值,请在设置列值后设置单元值。To override the specified value for individual cells, set the cell values after you set the column value.

适用于

另请参阅