private void Form1_Load(object sender, System.EventArgs e)
        {
            DevExpress.XtraBars.BarEditItem item;
            DevExpress.XtraEditors.Repository.RepositoryItemComboBox    combo;
            DevExpress.XtraEditors.Repository.RepositoryItemProgressBar progress;

            barManager1.ForceInitialize();

            // create combo
            combo = barManager1.RepositoryItems.Add("ComboBoxEdit") as DevExpress.XtraEditors.Repository.RepositoryItemComboBox;
            combo.Items.Add("Item A");
            combo.Items.Add("Item B");
            item           = new DevExpress.XtraBars.BarEditItem(barManager1);
            item.Edit      = combo;
            item.EditValue = "[n/a]";
            item.Width     = 100;
            barStandard.AddItem(item);

            // create progress
            progress       = barManager1.RepositoryItems.Add("ProgressBarControl") as DevExpress.XtraEditors.Repository.RepositoryItemProgressBar;
            item           = new DevExpress.XtraBars.BarEditItem(barManager1);
            item.Edit      = progress;
            item.EditValue = 26;             // 26%
            item.Width     = 150;
            barStatus.AddItem(item);
        }
Пример #2
0
        private void addItemToBar(DevExpress.XtraBars.Bar sourceItem, DevExpress.XtraBars.BarItem newItem)
        {
            DevExpress.XtraBars.BarItemLink linkForDelete = null;
            foreach (DevExpress.XtraBars.BarItemLink link in sourceItem.ItemLinks)
            {
                if (link.Caption == newItem.Caption)
                {
                    linkForDelete = link; break;
                }
            }
            if (linkForDelete != null)
            {
                sourceItem.RemoveLink(linkForDelete);
            }

            int newID = sourceItem.ItemLinks.Count;

            newItem.Id = newID;
            sourceItem.AddItem(newItem);
        }