示例#1
0
        //设置 ImageComboBox 的值。
        private void setImageCobItems(DevExpress.XtraEditors.Repository.RepositoryItemImageComboBox cobItem, MB.WinBase.Common.ColumnEditCfgInfo editInfo)
        {
            if (editInfo.DataSource == null)
            {
                return;
            }

            string txtName = editInfo.TextFieldName;

            cobItem.Items.Clear();

            IList lstDatas = editInfo.DataSource as IList;

            if (lstDatas != null)
            {
                foreach (object entity in lstDatas)
                {
                    object value = MB.Util.MyReflection.Instance.InvokePropertyForGet(entity, txtName);
                    cobItem.Items.Add(new DevExpress.XtraEditors.Controls.ImageComboBoxItem(value));
                }
            }
            else
            {
                DataTable dtData = MB.Util.MyConvert.Instance.ToDataTable(editInfo.DataSource, string.Empty);
                foreach (DataRow dr in dtData.Rows)
                {
                    cobItem.Items.Add(new DevExpress.XtraEditors.Controls.ImageComboBoxItem(dr[txtName]));
                }
            }
        }
示例#2
0
        public static RepositoryItemImageComboBox GetCotDuyet()
        {
            ImageCollection imglist = new ImageCollection();
            FWImageDic.GET_DUYET_STATUS16(imglist);

            DevExpress.XtraEditors.Repository.RepositoryItemImageComboBox itemImageComboBox = new DevExpress.XtraEditors.Repository.RepositoryItemImageComboBox();
            itemImageComboBox.SmallImages = imglist;
            itemImageComboBox.Items.AddRange(
                new object[] { new DevExpress.XtraEditors.Controls.ImageComboBoxItem("Chưa duyệt", "1", 0),
                               new DevExpress.XtraEditors.Controls.ImageComboBoxItem("Duyệt", "2", 1),
                               new DevExpress.XtraEditors.Controls.ImageComboBoxItem("Không duyệt", "3", 2) });
            itemImageComboBox.GlyphAlignment = DevExpress.Utils.HorzAlignment.Center;

            return itemImageComboBox;
        }