您可以通过绑定到KeyDown(或KeyUp)事件来简单地开始ListView:
listView1.KeyDown += listView1_KeyDown;
Run Code Online (Sandbox Code Playgroud)
然后在事件中:
void listView1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Delete)
{
// Check if selected item is editable and act accordingly...
// Bypass the control's default handling;
// otherwise, remove to pass the event to the default control handler.
e.Handled = true;
}
}
Run Code Online (Sandbox Code Playgroud)