大家好,又见面了,我是全栈君,今天给大家准备了Idea注册码。
网上搜索的 例子 加 自己的 一点点补充
lookupedit 设置选项值:
private void LookUpEditFormTest_Load(object sender, EventArgs e) { IList<Hiscashs> list = HiscashsService.GetTableCovList(); this.comboBoxEdit1.Properties.DataSource = list; this.comboBoxEdit1.Properties.DisplayMember = "EN_CURRENT_BALANCE"; this.comboBoxEdit1.Properties.ValueMember = "I_ENTER_DATE"; comboBoxEdit1.Properties.Columns.Add(new LookUpColumnInfo("I_ENTER_DATE", "日期", 20)); comboBoxEdit1.Properties.Columns.Add(new LookUpColumnInfo("EN_CURRENT_BALANCE", "当前金额", 80)); //comboBoxEdit1.ItemIndex = 0;//选择第一项 comboBoxEdit1.ItemIndex = -1; //无选项,此时显示的是nulltext值 其实这个地方只要editvalue==null,lookupedit就显示nulltext } private void comboBoxEdit1_EditValueChanged(object sender, EventArgs e) { string name = this.comboBoxEdit1.SelectedText; string value = this.comboBoxEdit1.EditValue.ToString();//自动搜索datasouse,选择与之匹配的值,没有的情况下赋值null ,value的值必须与valuemember的数据类型一致。 MessageBox.Show(name+"==="+value); } /* 何问起 hovertree.com */
checkedComboBoxEdit 设置选项值:
public void TestFunc() { for (int i = 0; i < IniFunc().Count; i++) { if (IniFunc()[i].Isno == true) checkedComboBoxEdit1.Properties.Items.Add(i, IniFunc()[i].Name, CheckState.Checked, true); else checkedComboBoxEdit1.Properties.Items.Add(i, IniFunc()[i].Name, CheckState.Unchecked, true); } //取消第二列的选中状态 checkedComboBoxEdit1.Properties.Items[1].CheckState = CheckState.Unchecked; //checkedComboBoxEdit1 MessageBox.Show(this.checkedComboBoxEdit1.SelectedText + "===" + this.checkedComboBoxEdit1.EditValue.ToString()); } public BindingList<Data> IniFunc() { BindingList<Data> bindlist = new BindingList<Data>(); bindlist.Add(new Data { ID = 1, Name = "科比", Isno = true }); bindlist.Add(new Data { ID = 2, Name = "艾佛森", Isno = false }); bindlist.Add(new Data { ID = 3, Name = "姚明", Isno = false }); bindlist.Add(new Data { ID = 4, Name = "韦德", Isno = true }); bindlist.Add(new Data { ID = 5, Name = "詹姆斯", Isno = true }); return bindlist; } } public class Data { public int ID { get; set; } public string Name { get; set; } public bool Isno { get; set; } } /* 何问起 hovertree.com */
补充: checkedComboBoxEdit 多选设置
反绑定 重点:
DevExpress.XtraEditors.CheckedComboBoxEdit cmb_check_CKID = new DevExpress.XtraEditors.CheckedComboBoxEdit(); private void GetAllCK() { List<TB_STORE> list = (List<TB_STORE>)serviceLocator.GetService<ITB_STOREBLL>().GetAllStore(StaticUser.ConmanyID);//<span style="color:#FF0000;"><strong>LISt数据源</strong></span> cmb_check_CKID.Properties.DataSource = list; cmb_check_CKID.Properties.DisplayMember = "STORENAME"; cmb_check_CKID.Properties.ValueMember = "ID"; cmb_check_CKID.Properties.SeparatorChar = ','; //<span style="color:#FF0000;">逗号 隔开</span> 存储的 值是 编号(ID)如 2,3,4 } this.cmb_check_CKID.RefreshEditValue();//反绑定的 时候 这句很重要 /* 何问起 hovertree.com */
http://www.cnblogs.com/roucheng/p/DGVHeaderText.html
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/120492.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...