Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I hide the drop-down arrow of a DataGridViewComboBoxColumn like Visual Studio Properties window?

I have a DataGridView where one of the columns is a DataGridViewComboBoxColumn. When the grid is populated, that column looks different because of the drop-down arrow appearing on each cell in the column. I'd like to change this so that the drop-down arrow is hidden and only shows up when the row is actually highlighted or when the combobox cell is selected for editing. The behavior I wanted is like how the Properties window in Visual Studio handles its values.

like image 861
dawntrader Avatar asked Jul 10 '09 00:07

dawntrader


2 Answers

In the DataGridViewComboBoxColumn, there is a property called DisplayStyle. Set it to Nothing to hide the DropDownButton

Further information about the DataGridViewComboBoxDisplayStyle enumeration is available at this MSDN link

like image 74
Joe Avatar answered Nov 18 '22 21:11

Joe


If you set DataGridViewComboBoxColumn.DisplayStyleForCurrentCellOnly = True, then the dropdown only appears when the cell is the current cell.

like image 38
SSS Avatar answered Nov 18 '22 20:11

SSS