How to manually drop down a DataGridViewComboBoxColumn?

前端 未结 7 1488
清酒与你
清酒与你 2020-12-01 14:20

I have a DataGridView with one DataGridViewComboBoxColumn in my WinForms application. I need to drop down (open) this DataGridViewComboBoxColumn manually, let\'s say after a

相关标签:
7条回答
  • 2020-12-01 14:54

    FYI: Here is nvivekgoyal's code from the reference in his answer:

    private void datagridview1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
    {
        ComboBox ctrl = e.Control as ComboBox;
        ctrl.Enter -= new EventHandler(ctrl_Enter);
        ctrl.Enter += new EventHandler(ctrl_Enter);
    }
    
    void ctrl_Enter(object sender, EventArgs e)
    {
        (sender as ComboBox).DroppedDown = true;
    }
    
    0 讨论(0)
提交回复
热议问题