private void refreshCreatures() { foreach (Control c in creatureControls) { Controls.Remove(c); c.Dispose(); } List <TibiaObject> creatures = new List <TibiaObject>(); foreach (int creatureid in hunting_place.creatures) { Creature cr = MainForm.getCreature(creatureid); creatures.Add(cr); } MainForm.PageInfo pageInfo = new MainForm.PageInfo(false, false); int newWidth; int y = baseY + MainForm.DisplayCreatureAttributeList(this.Controls, creatures, 10, baseY, out newWidth, null, creatureControls, currentPage, 10, pageInfo, null, null, sortFunction, sortedHeader, desc); if (pageInfo.prevPage || pageInfo.nextPage) { if (pageInfo.prevPage) { PictureBox prevpage = new PictureBox(); prevpage.Location = new Point(10, y); prevpage.Size = new Size(97, 23); prevpage.Image = MainForm.prevpage_image; prevpage.BackColor = Color.Transparent; prevpage.SizeMode = PictureBoxSizeMode.Zoom; prevpage.Click += Prevpage_Click; this.Controls.Add(prevpage); creatureControls.Add(prevpage); } if (pageInfo.nextPage) { PictureBox nextpage = new PictureBox(); nextpage.Location = new Point(Math.Max(newWidth, this.Size.Width) - 108, y); nextpage.Size = new Size(98, 23); nextpage.BackColor = Color.Transparent; nextpage.Image = MainForm.nextpage_image; nextpage.SizeMode = PictureBoxSizeMode.Zoom; nextpage.Click += Nextpage_Click; this.Controls.Add(nextpage); creatureControls.Add(nextpage); } y += 25; } refreshTimer(); this.Size = new Size(Math.Max(this.Size.Width, newWidth), y + 10); }
private void refresh() { foreach (Control c in controlList) { this.Controls.Remove(c); c.Dispose(); } if (currentControlList == -1) { return; } updateCommand(); for (int i = 0; i < headers.Length; i++) { if (objectControls[i] != null) { objectControls[i].Enabled = i != currentControlList; if (i == currentControlList) { (objectControls[i] as Label).BorderStyle = BorderStyle.Fixed3D; } else { (objectControls[i] as Label).BorderStyle = BorderStyle.FixedSingle; } } } controlList.Clear(); int newwidth; MainForm.PageInfo pageInfo = new MainForm.PageInfo(false, false); int y = base_y + MainForm.DisplayCreatureAttributeList(this.Controls, objectList[currentControlList], 10, base_y, out newwidth, null, controlList, currentPage, 15, pageInfo, extraAttributes[currentControlList], attributeFunctions[currentControlList], sortHeader, sortedHeader, desc, attributeSortFunctions[currentControlList], removedLists[currentControlList]); newwidth = Math.Max(newwidth, this.Size.Width); if (pageInfo.prevPage || pageInfo.nextPage) { if (pageInfo.prevPage) { PictureBox prevpage = new PictureBox(); prevpage.Location = new Point(10, y); prevpage.Size = new Size(97, 23); prevpage.Image = MainForm.prevpage_image; prevpage.BackColor = Color.Transparent; prevpage.SizeMode = PictureBoxSizeMode.Zoom; prevpage.Click += Prevpage_Click;; this.Controls.Add(prevpage); controlList.Add(prevpage); } if (pageInfo.nextPage) { PictureBox nextpage = new PictureBox(); nextpage.Location = new Point(newwidth - 108, y); nextpage.Size = new Size(98, 23); nextpage.BackColor = Color.Transparent; nextpage.Image = MainForm.nextpage_image; nextpage.SizeMode = PictureBoxSizeMode.Zoom; nextpage.Click += Nextpage_Click;; this.Controls.Add(nextpage); controlList.Add(nextpage); } y += 25; } this.Size = new Size(newwidth, y + 10); }
private void refresh() { foreach (Control c in createdControls) { this.Controls.Remove(c); c.Dispose(); } int base_y = this.listTitle.Location.Y + this.listTitle.Height + 10; int newWidth = 352; MainForm.PageInfo pageInfo = new MainForm.PageInfo(false, false); int y; if (displayType == DisplayType.Details) { y = MainForm.DisplayCreatureAttributeList(this.Controls, objects, 10, base_y, out newWidth, null, createdControls, currentPage, 20, pageInfo, null, null, sortHeader, sortedHeader, desc, null, null, addConditionalAttributes); } else { y = MainForm.DisplayCreatureList(this.Controls, objects, 10, base_y, 344, 4, null, 1, createdControls, currentPage, 600, pageInfo, currentDisplay); if (currentDisplay >= 0) { currentDisplay = -1; currentPage = pageInfo.currentPage; } } startDisplay = pageInfo.startDisplay; updateCommand(); newWidth = Math.Max(newWidth, 275); if (pageInfo.prevPage) { PictureBox prevpage = new PictureBox(); prevpage.Location = new Point(10, base_y + y); prevpage.Size = new Size(97, 23); prevpage.Image = MainForm.prevpage_image; prevpage.BackColor = Color.Transparent; prevpage.SizeMode = PictureBoxSizeMode.StretchImage; prevpage.Click += Prevpage_Click; this.Controls.Add(prevpage); createdControls.Add(prevpage); } if (pageInfo.nextPage) { PictureBox nextpage = new PictureBox(); nextpage.Location = new Point(10 + newWidth - 108, base_y + y); nextpage.Size = new Size(98, 23); nextpage.BackColor = Color.Transparent; nextpage.Image = MainForm.nextpage_image; nextpage.SizeMode = PictureBoxSizeMode.StretchImage; nextpage.Click += Nextpage_Click; this.Controls.Add(nextpage); createdControls.Add(nextpage); } toggleButton.Location = new Point(newWidth - toggleButton.Size.Width, toggleButton.Location.Y); if (pageInfo.prevPage || pageInfo.nextPage) { y += 23; } this.Size = new Size(10 + newWidth, base_y + y + 10); this.refreshTimer(); }