C# ListBox怎么使用"Delete"删除里面的内容??
我给ListBox绑了一个KeyPress事件,写法如下,没反映???privatevoidlistBox1_KeyPress(objectsender,KeyPress...
我给ListBox绑了一个KeyPress事件,写法如下,没反映???
private void listBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (listBox1.Items.Count == 0)
{
return;
}
if (e.KeyChar == (Char)Keys.Delete)
{
listBox1.Items.RemoveAt(listBox1.SelectedIndex);
}
} 展开
private void listBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (listBox1.Items.Count == 0)
{
return;
}
if (e.KeyChar == (Char)Keys.Delete)
{
listBox1.Items.RemoveAt(listBox1.SelectedIndex);
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询