public DeleteButton(IBtnDeleteItem item) : base(AppImage.Delete) { ((MyListItem)item).AddCtr(this); this.MouseDown += (sender, e) => { if (MessageBoxEx.Show(AppString.MessageBox_ConfirmDelete, MessageBoxButtons.YesNo) == DialogResult.Yes) { item.DeleteMe(); } }; }
public DeleteButton(IBtnDeleteItem item) : base(AppImage.Delete) { MyListItem listItem = (MyListItem)item; listItem.AddCtr(this); this.MouseDown += (sender, e) => { if (MessageBoxEx.Show(AppString.Message.ConfirmDelete, MessageBoxButtons.YesNo) == DialogResult.Yes) { MyList list = (MyList)listItem.Parent; int index = list.GetItemIndex(listItem); index -= (index < list.Controls.Count - 1) ? 0 : 1; item.DeleteMe(); list.HoveredItem = (MyListItem)list.Controls[index]; } }; }