随笔 - 62  文章 - 11 评论 - 171 trackbacks - 1

        private void comboBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {         
            // if条件检测按下的是不是Enter键
            if(e.KeyChar == (char)13)  
            {
                if(!this.comboBox1.DroppedDown)
                {
                    this.comboBox1.DroppedDown = true;
                    e.Handled = true;
                }
            }
        }

    以上方法可以通过回车键和光标上下键,来实现comboBox的下拉一览和数据选择。
posted on 2007-10-19 17:02 PCJIM 阅读(559) 评论(0) 编辑 收藏