private void btnAddSkill_Click(object sender, EventArgs e) { SkillListBoxObj info = new SkillListBoxObj(numSkillIndex.Value.ToString()); if (chkShouldUse.Checked) { if (numWait.Value != 0) { info.Skill = $"{info.Skill} WW{numWait.Value}"; } if (numHealth.Value != 0) { info.Skill = $"{info.Skill} H{lblGreaterHealth.Text}{numHealth.Value}"; } if (numMana.Value != 0) { info.Skill = $"{info.Skill} M{lblGreaterMana.Text}{numMana.Value}"; } if (chkSkip.Checked) { info.Skill = $"{info.Skill}S"; } } lstSkillSequence.Items.Add(info); }
private void lstSkillSequence_DragDrop(object sender, DragEventArgs e) { ListBox lst = sender as ListBox; SkillListBoxObj info = (SkillListBoxObj)e.Data.GetData(typeof(SkillListBoxObj)); Point point = lst.PointToClient(new Point(e.X, e.Y)); int newIndex = lst.IndexFromPoint(point); if (newIndex == -1) { newIndex = lst.Items.Count - 1; } lst.Items.Remove(info); lst.Items.Insert(newIndex, info); lst.SelectedIndex = newIndex; }
private void MoveSkill(int direction) { if (lstSkillSequence.SelectedItem == null || lstSkillSequence.SelectedIndex < 0) { return; } int newIndex = lstSkillSequence.SelectedIndex + direction; if (newIndex < 0 || newIndex >= lstSkillSequence.Items.Count) { return; } SkillListBoxObj info = lstSkillSequence.SelectedItem as SkillListBoxObj; lstSkillSequence.Items.Remove(info); lstSkillSequence.Items.Insert(newIndex, info); lstSkillSequence.SetSelected(newIndex, true); }