0

After some work with Google I find the answer to this is to intercept the paint event, draw only the background and call it done.

This correctly disposed of the buttons and the checkbox on the rows in question but the ComboBoxes are now black squares and they are actually still there--you can drop them down.

Attempting to replace the offending items with DataGridViewTextBoxCells caused a crash in the paint routine.

I need to add some total rows mixed in with the data rows. Completely non-interactive and most columns should just be blank. How do I do it??

Loren Pechtel
  • 8,945
  • 3
  • 33
  • 45
  • Have you tried using "Visible" property of the combobox? – Francesco Milani May 25 '17 at 09:28
  • When you hide the offending ComboBox on certain rows, what is your expected look of the remaining cell? That of an empty TextBoxCell? Making the entire cell [look non-existant](https://stackoverflow.com/a/43986766/3773066)? – OhBeWise May 25 '17 at 13:59
  • @FrancescoMilani The visible property of cells in a DataGridView is read only. – Loren Pechtel May 26 '17 at 01:11
  • @OhBeWise Yeah, like an empty text cell. The buttons and checkboxes worked fine, I just get white space. The handlers see they are on a total row and immediately exit. I have to provide an empty image for the column that contains graphics but that's no big deal. – Loren Pechtel May 26 '17 at 01:13
  • what about something like this: cmbHidden.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing; cmbHidden.ReadOnly = true; – Francesco Milani May 26 '17 at 10:36
  • My apologies on my misguided answer. For some reason I mistook CheckBox for ComboBox when working a solution. – OhBeWise May 28 '17 at 05:10
  • @OhBeWise When I was Googling about it everybody was talking about hiding checkboxes, not comboboxes. – Loren Pechtel May 29 '17 at 12:01

0 Answers0