在按键里判断是不明是回车键,然后
combobox1.DroppedDown=true;

解决方案 »

  1.   


            private void comboBox1_KeyPress(object sender, KeyPressEventArgs e)
            {
                if (e.KeyChar == (char)Keys.Return)
                    comboBox1.DroppedDown = true;
            }
      

  2.   

    楼上的方法好像不行。这样可以:        [DllImport("user32.dll")]        public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
            const int CB_SHOWDROPDOWN = 0x014F;
            const int CB_GETDROPPEDSTATE = 0x0157;        private void comboBox1_KeyDown(object sender, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter)
                {
                        SendMessage(comboBox1.Handle, CB_SHOWDROPDOWN, 1, 0);
                        e.Handled = true;
                }
            }
      

  3.   

    我想问下,如果combobox是在dataGridView中的,应该怎么用啊
      

  4.   

    if (e.KeyCode == Keys.Enter&& comboBox1.DroppedDown == false)
                { e.Handled = true;
                    SendKeys.SendWait("{F4}");
                }
      

  5.   

      private void comboBox1_KeyPress(object sender, KeyPressEventArgs e)
            {
                if (e.KeyChar == (char)Keys.Return)
                    comboBox1.DroppedDown = true;
            }