zoukankan      html  css  js  c++  java
  • Dev Express之ImageComboBoxEdit,RepositoryItemImageComboBox使用方式

     Dev Express之ImageComboBoxEdit,RepositoryItemImageComboBox使用方式

    1.使用ImageComboBoxEdit实现下拉框键值数据函数

            public static void InitCmb(ImageComboBoxEdit cmb, DataTable source, string value, string text, bool isDefaultNull)
            {
                ImageComboBoxItem[] items = new ImageComboBoxItem[source.Rows.Count +1];
                int i = 0;
                if (isDefaultNull)
                {
                    items[i] = new ImageComboBoxItem();
                    items[i].Description = "";
                    items[i].Value = "";
                    items[i].ImageIndex = -1;
                    i++;
                }
    
                foreach (DataRow dr in source.Rows)
                {
                    items[i] = new ImageComboBoxItem();
                    items[i].Description = dr[text].ToString();
                    items[i].Value = dr[value]; 
                    items[i].ImageIndex = -1;
                    i++;
                }
                cmb.Properties.Items.Clear();
                cmb.Properties.Items.AddRange(items);            
                cmb.EditValue = items[0].Value;
            }

    2.使用RepositoryItemImageComboBox实现GridControl内容Cell内下拉键值数据函数

            public static void InitCmb(RepositoryItemImageComboBox repImageComboBox, DataTable source,string value,string text,bool isDefaultNull)
            {
                ImageComboBoxItem[] items = new ImageComboBoxItem[source.Rows.Count+1];
                int i=0;
                if (isDefaultNull)
                {
                    items[i] = new ImageComboBoxItem();
                    items[i].Description = "";
                    items[i].Value = "";
                    items[i].ImageIndex = -1;
                    i++;
                }
                foreach (DataRow dr in source.Rows)
                {
                    items[i] = new ImageComboBoxItem();
                    items[i].Description = dr[text].ToString();
                    items[i].Value = dr[value];
                    items[i].ImageIndex = -1;
                    i++;
                }
                repImageComboBox.Items.AddRange(items);
            }

    3.使用RepositoryItemImageComboBox/ImageComboBox与ImageCollection结合实现GridControl内容Cell内下拉图片数据函数

            public static void InitImgCmb(RepositoryItemImageComboBox repImageComboBox, DataTable source, string value, bool isDefaultNull)
            {
                ImageComboBoxItem[] items = new ImageComboBoxItem[source.Rows.Count + 1];
                int i = 0;
                if (isDefaultNull)
                {
                    items[i] = new ImageComboBoxItem();
                    items[i].Description = "";
                    items[i].Value = "";
                    items[i].ImageIndex = -1;
                    i++;
                }
                foreach (DataRow dr in source.Rows)
                {
                    items[i] = new ImageComboBoxItem();
                    items[i].Description = "";
                    items[i].Value = dr[value];
                    if(Int32.Parse(items[i].Value.ToString()) == 0){
                        items[i].ImageIndex = 0;
                    }else if(Int32.Parse(items[i].Value.ToString()) == 1){
                        items[i].ImageIndex = 1;
                    }else if(Int32.Parse(items[i].Value.ToString()) == 2){
                        items[i].ImageIndex = 2;
                    }else if(Int32.Parse(items[i].Value.ToString()) == 3){
                        items[i].ImageIndex = 3;
                    }else if(Int32.Parse(items[i].Value.ToString()) == 4){
                        items[i].ImageIndex = 4;
                    }
                    i++;
                }
                repImageComboBox.Items.AddRange(items);
            }
  • 相关阅读:
    值初始化-new
    CLI-error
    批量处理
    makefile --文件文档经链接使用
    数据库查询优化
    动态加载数据抓取-Ajax
    requests.post()
    requests.get()参数
    xpath练习(链家二手房案例,百度贴吧图片抓取案例)
    xpath解析.lxml解析库
  • 原文地址:https://www.cnblogs.com/ultimateWorld/p/5481394.html
Copyright © 2011-2022 走看看