Combo Box Size Issue After All Items Are Removed

前端 未结 4 1002
梦毁少年i
梦毁少年i 2021-01-13 04:37

My application contains a ComboBox that the user can delete items from. When the program starts up it populates the ComboBox from a list of strings read in from a configurat

4条回答
  •  轮回少年
    2021-01-13 05:20

    Try to use this at the end of your code when you are filling the combobox items:

    comboBoxNumTreno.IntegralHeight = true; // auto fit dropdown list
    

    Then to clear it up:

    comboBoxNumTreno.ResetText();
    comboBoxNumTreno.Items.Clear();
    comboBoxNumTreno.SelectedIndex = -1;
    comboBoxNumTreno.DropDownHeight = 106; // default value
    comboBoxNumTreno.IntegralHeight = false; 
    

提交回复
热议问题