【WinForm】Dev ComboxEdit、RepositoryItemComboBox、ComboBox操作汇总

一、ComboxEdit

1、添加选项

this.cbx_Industies.Properties.Items.AddRange("AAA"); //通过comboxEdit的Properties属性进行添加


2、comboxEdit禁止手动输入,只可下拉选

设置其properties中的TextEditStyle设置为DisableTextEditor

如果允许输入自定义值设置为Standard即可

 

3、只允许选择下拉选项,不允许输入数据

combboxEdit.propoties.textEditStyle=DisableTextEditor

 

二、RepositoryItemComboBox

BarManager中添加下拉框,barEditItem真正绑定的控件是RepositoryItemComboBox,修改属性时是对它进行修改。

1、添加下拉框选项

repositoryItemComboBox1.Items.Add("1");
repositoryItemComboBox1.Items.Add("2");
repositoryItemComboBox1.Items.Add("3");

 

2、设置初始值

使用其上一层级的控件

barEditItem1.EditValue = "2";

 

3、获得下框的选定值

string str = barEditItem1.EditValue.ToString();
MessageBox.Show("选项值:" + str);
int num=repositoryItemComboBox1.Items.IndexOf(str);
MessageBox.Show("索引值:" + num.ToString());

 

 

三、ComboBox

1、改变ComboBox大小

设置Font字体的大小

 

2、禁止手动输入,只可下拉选

把DropDownStyle属性设置成DropDownList。

posted @ 2021-06-23 15:39  不溯流光  阅读(1560)  评论(0编辑  收藏  举报