private void refreshAttributes() { foreach (Control c in createdControls) { c.Dispose(); this.Controls.Remove(c); } createdControls.Clear(); List <TibiaObject> taskCreatures = new List <TibiaObject>(); if (viewCreatures) { foreach (int creatureid in task.creatures) { taskCreatures.Add(MainForm.getCreature(creatureid)); } } else { foreach (int huntid in task.hunts) { taskCreatures.Add(MainForm.getHunt(huntid)); } } int newWidth; int y = MainForm.DisplayCreatureAttributeList(this.Controls, taskCreatures, 5, baseHeight, out newWidth, null, createdControls); this.Size = new System.Drawing.Size(Math.Max(newWidth, baseWidth), baseHeight + y); }