C # - Help with custom DatagridView cell options

I am trying to configure a DataGridView cell to include a combobox and text box. So far, the myCell class is derived from the DataGridViewTextBoxCell class. My class has Combobox as a private member, but I'm not sure how I can do this. I override the pain method, but I have no idea how to draw a drop-down list. I set its location at the beginning of the cell and its size is equal to the size of the cell. I know that if I were creating a combobox in a form that I would have to add to my forms for example to manage the list, so it will be drawn, but in this case I really do not know how to do it.

Note. I do not use any sql-db.

Ideally, I will have a combo box displayed in the top half of my cell and a text box in the bottom half of my cell where users can change text at runtime.

Does anyone know a better way to achieve this?

Thanks.

+4
source share
1 answer

I would try to get from IDataGridViewEditingControl and a custom UserControl that has your requirements (TextBox and ComboBox).
But check if the ComboBox alone is no longer enough. Depending on the DropDownStyle, your user may already modify the contents of the ComboBox.

+3
source

All Articles