开发者

Select ComboBox in Windows Forms ToolStrip

开发者 https://www.devze.com 2023-03-13 05:38 出处:网络
I have a problem focusing a ComboBox in a Windowsforms \"ToolStrip\" (C++ Cli). I used the Designer to create a ToolStrip in my form and added a ComboBox (System.Windows.Forms.ToolStripComboBox) and

I have a problem focusing a ComboBox in a Windowsforms "ToolStrip" (C++ Cli).

I used the Designer to create a ToolStrip in my form and added a ComboBox (System.Windows.Forms.ToolStripComboBox) and it is visible and enabled.

When the form is loaded I want t开发者_Python百科hat Combobox to be selected, so I tried the following in the form-constructor.

this->CBox1->focus()

and

this->ToolStrip1->focus()  
this->CBox1->select()

none works.

Does anybody know how to make it work?


The ToolStripComboBox class contains a ComboBox property that enables you to access its embedded ComboBox control. This appears to work (C# code):

this.Cbox1.ComboBox.Select();
0

精彩评论

暂无评论...
验证码 换一张
取 消