• Dev控件的用法


    1、DevExpress.XtraEditors.LookUpEdit的基本用法

    public void InitLookUpEditor()
        {
            //
            this.lookupEditFields.Properties.Columns.AddRange(new DevExpress.XtraEditors.Controls.LookUpColumnInfo[] {
                new DevExpress.XtraEditors.Controls.LookUpColumnInfo("DisplayMember", "DisplayMember", 20, DevExpress.Utils.FormatType.None, "", true, DevExpress.Utils.HorzAlignment.Default, DevExpress.Data.ColumnSortOrder.None),
                new DevExpress.XtraEditors.Controls.LookUpColumnInfo("ValueMember", "", 20, DevExpress.Utils.FormatType.None, "", false, DevExpress.Utils.HorzAlignment.Default, DevExpress.Data.ColumnSortOrder.None)});
    
            DataTable dt = new DataTable();
            dt.Columns.Add("ValueMember");
            dt.Columns.Add("DisplayMember");
            dt.Columns.Add("DataType");
            dt.Columns.Add("IsExtandedField");
    
            DataRow row = dt.NewRow();
            row["DataType"] = "";
            row["IsExtandedField"] = true;
            row["DisplayMember"] = "";
            row["ValueMember"] = "";
            dt.Rows.Add(row);
    
            this.lookupEditFields.Properties.DisplayMember = "DisplayMember";
            this.lookupEditFields.Properties.ValueMember = "ValueMember";
            this.lookupEditFields.Properties.DataSource = dt;
    
            if (dt.Rows.Count > 0)
            {
                //自动搜索datasouse,选择与之匹配的值,没有的情况下赋值null ,value的值必须与valuemember的数据类型一致。
                lookupEditFields.EditValue = Convert.ToString(dt.Rows[0]["ValueMember"]);
                //this.lookupEditFields.ItemIndex = 0;
            }
    
      }     

    想取这行数据的DataType值:

    string dataType = Convert.ToString(cboList.GetColumnValue("DataType"));

    2、DevExpress.XtraEditors.ComboBoxEdit的基本用法

    public void InitComboxEditou()
        {
            comboBoxOperator.Properties.Items.Clear();
            comboBoxOperator.Properties.Items.AddRange(new object[] {
                            "等于","大于","大于等于","小于","小于等于","不等于" });
            comboBoxOperator.EditValue = "等于";
    
        }
  • 相关阅读:
    怎样跟老板提加薪,来看看自己值多少钱
    leetcode-204-Count Primes
    Atitit. 异常的使用总结最佳实践java .net php Vo8f
    设计模式——第一课
    linux svn命令具体解释
    BTrace介绍和生产环境样例
    5.3.5 namedtuple() 创建命名字段的元组结构
    linux驱动开发之九鼎板载蜂鸣器驱动测试【转】
    hrtimer高精度定时器的简单使用【学习笔记】
    Linux时间子系统之(一):时间的基本概念【转】
  • 原文地址:https://www.cnblogs.com/liyongjian/p/2905766.html
Copyright © 2020-2023  润新知