DataGridViewComboBoxColumn.DisplayStyle DataGridViewComboBoxColumn.DisplayStyle DataGridViewComboBoxColumn.DisplayStyle DataGridViewComboBoxColumn.DisplayStyle Property

定义

获取或设置一个值,该值确定没有编辑时组合框的显示方式。Gets or sets a value that determines how the combo box is displayed when not editing.

public:
 property System::Windows::Forms::DataGridViewComboBoxDisplayStyle DisplayStyle { System::Windows::Forms::DataGridViewComboBoxDisplayStyle get(); void set(System::Windows::Forms::DataGridViewComboBoxDisplayStyle value); };
public System.Windows.Forms.DataGridViewComboBoxDisplayStyle DisplayStyle { get; set; }
member this.DisplayStyle : System.Windows.Forms.DataGridViewComboBoxDisplayStyle with get, set
Public Property DisplayStyle As DataGridViewComboBoxDisplayStyle

属性值

异常

注解

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属性值是false,则DisplayStyle属性会影响所有列的单元格中; 否则为DisplayStyle属性会都影响仅当前单元格。If the DisplayStyleForCurrentCellOnly property value is false, the DisplayStyle property affects all cells in the column; otherwise, the DisplayStyle property affects only the current cell.

行为和外观的单元格的下拉箭头将由FlatStyle属性。The behavior and appearance of the drop-down arrow in the cells is indicated by the FlatStyle property.

若要启用单元格突出显示鼠标指针位于单元格上时,必须设置DisplayStyle属性设置为ComboBoxFlatStyle属性设置为PopupTo enable cell highlighting when the mouse pointer is over a cell, you must set the DisplayStyle property to ComboBox and the FlatStyle property to Popup.

获取或设置此属性获取或设置DisplayStyle属性返回的对象CellTemplate属性。Getting or setting this property gets or sets the DisplayStyle property of the object returned by the CellTemplate property. 设置此属性还将设置DisplayStyle列显示属性中的列和刷新每个单元格。Setting this property also sets the DisplayStyle 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.

适用于

另请参阅