Пример #1
0
        private void LoadComboItems(ComboBoxEx cb)
        {
            bool blankSeen = false;

            ComboBox cbx = GridColumn.EditControl as ComboBox;

            if (cbx != null && cbx.Items.Count > 0)
            {
                MyComboItem[] items = new MyComboItem[cbx.Items.Count];

                for (int i = 0; i < cbx.Items.Count; i++)
                {
                    MyComboItem bi = new
                        MyComboItem("CbxEntry", cbx.GetItemText(cbx.Items[i]), i);

                    if (blankSeen == false && string.IsNullOrEmpty(bi.Text) == true)
                        blankSeen = true;

                    items[i] = bi;
                }

                if (blankSeen == false)
                    cb.Items.Add("");

                cb.Items.AddRange(items);
            }
        }
Пример #2
0
        private void LoadScanItems(ComboBoxEx cb)
        {
            List<object> list = _GridColumn.ScanItems;

            int n = Math.Min(list.Count, _GridColumn.FilterPopupMaxItems);

            MyComboItem[] items = new MyComboItem[n];

            bool blankSeen = false;

            for (int i = 0; i < n; i++)
            {
                object o = list[i];

                MyComboItem bi;

                if (o is DateTime)
                {
                    DateTime dt = (DateTime)o;
                    dt = dt.Date;

                    string s = dt.ToShortDateString();

                    bi = new MyComboItem("ScanDateEntry", s, dt);
                }
                else
                {
                    string s = o.ToString();

                    bi = new MyComboItem("ScanTextEntry", s, i);

                    if (blankSeen == false && string.IsNullOrEmpty(bi.Text) == true)
                        blankSeen = true;
                }

                items[i] = bi;
            }

            if (blankSeen == false)
                cb.Items.Add("");

            cb.Items.AddRange(items);
        }