DataGridViewComboBoxCell.DisplayStyle Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets a value that determines how the combo box is displayed when it is not in edit mode.
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
Property Value
One of the DataGridViewComboBoxDisplayStyle values. The default is DropDownButton.
Exceptions
The specified value when setting this property is not a valid DataGridViewComboBoxDisplayStyle value.
Remarks
The DisplayStyle property affects the appearance of the cell when it is not in edit mode, and regardless of whether it is read-only. When the cell is in edit mode, it always looks like a ComboBox control.
If the DisplayStyleForCurrentCellOnly property value is true
, the DisplayStyle property affects the cell only when it is the current cell.
The behavior and appearance of the drop-down arrow is indicated by the FlatStyle property.
To enable cell highlighting when the mouse pointer is over the cell, you must set the DisplayStyle property to ComboBox and the FlatStyle property value to Popup.
Setting the DisplayStyle property of the owning column 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.