private void removeicon(object sender, EventArgs e) { int icon = (sender as SelectedIcon).IconValue; CurrentItemType.Icons.Remove(icon); bool flagset = false; Control removeme = null; foreach (Control k in iconlayout.Controls) { Panel p = k as Panel; if (p != null) { Control iconcontrol = p.Controls[0]; SelectedIcon si = iconcontrol as SelectedIcon; if (si != null) { //move container one slot back AFTER the removed item if (si.IconValue == icon) { flagset = true; removeme = p; } } } } iconlayout.Controls.Remove(removeme); }
private void addiconbutton_Click(object sender, EventArgs e) { ChooseIcon chooseform = new ChooseIcon(itemicons); if (chooseform.ShowDialog() == DialogResult.OK) { SelectedIcon holder = new SelectedIcon(); holder.Size = new Size(2048, 2048); Panel pp = new Panel(); pp.Left = 10; pp.Top = 10; pp.Height = 32; pp.Width = 32; pp.Controls.Add(holder); holder.DoubleClick += new EventHandler(removeicon); holder.Image = itemicons.Image; //holder.Width = 32;holder.Height = 32; SetIcon(chooseform.Icon, holder); CurrentItemType.Icons.Add(chooseform.Icon); holder.IconValue = chooseform.Icon; iconlayout.Controls.Add(pp); foreach (Control k in equiptypeicongroup.Controls) { //Reposition(k); } } }
private void EditCurrentItemType() { if (CurrentItemType == null) { itemtypegroupbasics.Hide(); itemtypegroupmultipliers.Hide(); noitemdefwarning.Show(); slotselector.Hide(); return; } itemtypegroupbasics.Show(); itemtypegroupmultipliers.Show(); noitemdefwarning.Hide(); slotselector.Show(); ItemTypeName.Text = CurrentItemType.Name; lockform = true; equipcatbox.SelectedIndex = (int)CurrentItemType.ItemCategory; equiphpmultiplier.Value = (decimal)CurrentItemType.MainStatMultipliers[0]; equipmpmultiplier.Value = (decimal)CurrentItemType.MainStatMultipliers[1]; equippatkmultiplier.Value = (decimal)CurrentItemType.MainStatMultipliers[2]; equipmatkmultiplier.Value = (decimal)CurrentItemType.MainStatMultipliers[3]; equippdefmultiplier.Value = (decimal)CurrentItemType.MainStatMultipliers[4]; equipmdefmultiplier.Value = (decimal)CurrentItemType.MainStatMultipliers[5]; eqattrSTR.Value = CurrentItemType.AttributeRequirements[0]; eqattrAGI.Value = CurrentItemType.AttributeRequirements[1]; eqattrVIT.Value = CurrentItemType.AttributeRequirements[2]; eqattrINT.Value = CurrentItemType.AttributeRequirements[3]; iconlayout.Controls.Clear(); iconlayout.Controls.Add(addiconbutton); foreach (int icon in CurrentItemType.Icons) { SelectedIcon holder = new SelectedIcon(); holder.Size = new Size(2048, 2048); Panel pp = new Panel(); pp.Left = 10; pp.Top = 10; pp.Height = 32; pp.Width = 32; pp.Controls.Add(holder); holder.DoubleClick += new EventHandler(removeicon); holder.Image = itemicons.Image; //holder.Width = 32;holder.Height = 32; SetIcon(icon, holder); holder.IconValue = icon; iconlayout.Controls.Add(pp); } lockform = false; slotselector.Refresh(); //#todo: icon selection }