gpt4 book ai didi

c# - 如何允许用户编辑列表框中的项目?

转载 作者:可可西里 更新时间:2023-11-01 08:41:39 25 4
gpt4 key购买 nike

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

最佳答案

尝试使用 ListView control , 而不是。

设置它的LabelEdit property为 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();
}

关于c# - 如何允许用户编辑列表框中的项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5209405/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com