mirror of
https://github.com/BluePointLilac/ContextMenuManager.git
synced 2026-01-20 06:05:04 +08:00
删除项目不回滚到顶部
This commit is contained in:
@@ -14,12 +14,18 @@ namespace ContextMenuManager.Controls.Interfaces
|
||||
{
|
||||
public DeleteButton(IBtnDeleteItem item) : base(AppImage.Delete)
|
||||
{
|
||||
((MyListItem)item).AddCtr(this);
|
||||
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);
|
||||
item.DeleteMe();
|
||||
list.HoveredItem = (MyListItem)list.Controls[index - 1];
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using BluePointLilac.Methods;
|
||||
using BluePointLilac.Controls;
|
||||
using BluePointLilac.Methods;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
@@ -35,7 +36,12 @@ namespace ContextMenuManager.Controls.Interfaces
|
||||
}
|
||||
else if(MessageBoxEx.Show(AppString.Message.ConfirmDeletePermanently,
|
||||
MessageBoxButtons.YesNo) != DialogResult.Yes) return;
|
||||
|
||||
MyListItem listItem = (MyListItem)item;
|
||||
MyList list = (MyList)listItem.Parent;
|
||||
int index = list.GetItemIndex(listItem);
|
||||
item.DeleteMe();
|
||||
list.HoveredItem = (MyListItem)list.Controls[index - 1];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user