System.Windows.Forms.ListBox.ObjectCollection.AddRange C# (CSharp) Method

AddRange() public method

public AddRange ( ObjectCollection value ) : void
value ObjectCollection
return void
			public void AddRange (ObjectCollection value)
			{
				AddItems (value);
			}

Same methods

ListBox.ObjectCollection::AddRange ( object items ) : void

Usage Example

Exemplo n.º 1
0
        private void main_Load(object sender, EventArgs e)
        {
            //Generate objects
            ItemFetcher.GenerateObjects();

            //Custom items (soul ring recipe etc)
            if (File.Exists("cache/items.custom.json"))
            {
                ItemFetcher.GenerateObjects("cache/items.custom.json", true);
            }

            //Hide while the startup happens
            this.Visible = false;
            backup = new ListBox.ObjectCollection(new ListBox());

            GListBox1.ImageList = new ImageList();
            GListBox1.ImageList.ImageSize = new System.Drawing.Size(32, 24);

            //Imageindex
            int n = 0;
             try
                {
            foreach (Item it in ItemFetcher.AllItems)
            {
                try { GListBox1.ImageList.Images.Add(it.Name, Image.FromFile("cache\\items\\" + it.DotaName + ".png")); }
                catch
                {
                    GListBox1.ImageList.Images.Add(it.Name, Image.FromFile("cache\\items\\" + it.img ));
                }
                    GListBox1.Items.Add(new GListBoxItem(it.Name, n));
                    it.ImageListIndex = n;
                    n++;

            }
            }
                catch (Exception ex)
             {
                 MessageBox.Show("Error while loading files. Please verify cache and try again.","",MessageBoxButtons.OK,MessageBoxIcon.Error);
                }

            //Backup for searching
            backup.AddRange(GListBox1.Items);

            if (tabControl1.TabCount == 0)
            {
                //Creating Default tabs
                AddNewBuildtab("Starting Items");
                AddNewBuildtab("Early Game");
                AddNewBuildtab("Core Items");
                AddNewBuildtab("Situational");
                AddNewBuildtab("Luxury");
            }
            else
            {
                foreach (BuildTab b in tabControl1.TabPages)
                {
                    b.ItemList.LargeImageList = GListBox1.ImageList;
                    b.ItemList.SmallImageList = GListBox1.ImageList;
                }
            }
            //Change the Picture and text to match hero and build
            Image pic = Image.FromFile(hero.ImagePath);
            this.HeroNameLabel.Text = hero.Name + " - " + title;
            pictureBox1.Image = pic;
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            //Enable Tad dragger
            tabDragger = new TabDragger(tabControl1, TabDragBehavior.TabDragArrange);

            this.Visible = true;

            this.Text = "DIRE - Build";
        }
All Usage Examples Of System.Windows.Forms.ListBox.ObjectCollection::AddRange