如何允许用户编辑ListBox中的项目?

我想创建一个ListBox控件,允许用户编辑项目,如Launchy中的扩展名列表框。 在WinForms中这可能吗? 我尝试在该列表框中使用自动窗口信息,它显示为QWidget(可能与Qt相关)。

请尝试使用ListView控件 。

将其LabelEdit属性设置为True,以允许用户编辑项的名称。


要允许用户编辑新插入项目上的文本,可以使用以下代码:

 private void AddItemToListView() { // Add a new item to the ListView, with an empty label // (you can set any default properties that you want to here) ListViewItem item = listView1.Items.Add(String.Empty); // Place the newly-added item into edit mode immediately item.BeginEdit(); }