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

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

问题描述

我在 winforms 上有一个组合框.在 Enter 上,即使我打开它:

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 上打开组合,当用户单击前一个控件上的选项卡时,此组合正确打开.但是如果用户点击组合,它就会打开和关闭.如何正确地做到这一点?

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:如何正确打开组合框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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