Winforms:如何正确打开combobox? [英] Winforms: how to open combobox properly?

查看:75
本文介绍了Winforms:如何正确打开combobox?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在winforms有一个组合框。输入即使我打开它:

I have a combobox on the winforms. On Enter even I open it:

cbo.DroppedDown = true;

但是如果我这样做,组合立即打开和关闭。我做错了什么?

But if I do that the combo opens and closes immediately. What am I doing wrong?

我使用这个事件的原因是我需要在Tab上打开combo,当用户点击上一个控件的tab,这个组合正常打开。但如果用户单击组合,它打开和关闭。如何正确地做?

The reason why I use this event is I need to open combo on Tab, when user click tab on the previous control, this combo opens properly. But if user clicks the combo it opens and closes. How to do that properly?

感谢

推荐答案

就像这样:

private void comboBox1_enter(object sender, EventArgs e)
      {
         comboBox1.DroppedDown = true;
      }

不会更改mouseup或计时器。它的行为正如预期。无论我是用鼠标点击选择组合框,或者选择了它,下拉列表出现并保持打开直到我选择了一些东西。

no changes to mouseup or timers. it behaved just as expected. Whether I selected the comboBox with a mouse click or tabbed into it the drop down list appeared and stayed open until I selected something.

我会看看是否有东西否则将焦点移开盒子。

I would look to see if there is something else pulling focus off the box.

这篇关于Winforms:如何正确打开combobox?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆