<bdo id='S8iOX'></bdo><ul id='S8iOX'></ul>
    <i id='S8iOX'><tr id='S8iOX'><dt id='S8iOX'><q id='S8iOX'><span id='S8iOX'><b id='S8iOX'><form id='S8iOX'><ins id='S8iOX'></ins><ul id='S8iOX'></ul><sub id='S8iOX'></sub></form><legend id='S8iOX'></legend><bdo id='S8iOX'><pre id='S8iOX'><center id='S8iOX'></center></pre></bdo></b><th id='S8iOX'></th></span></q></dt></tr></i><div id='S8iOX'><tfoot id='S8iOX'></tfoot><dl id='S8iOX'><fieldset id='S8iOX'></fieldset></dl></div>

    1. <small id='S8iOX'></small><noframes id='S8iOX'>

      <tfoot id='S8iOX'></tfoot>
    2. <legend id='S8iOX'><style id='S8iOX'><dir id='S8iOX'><q id='S8iOX'></q></dir></style></legend>

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

      时间:2023-10-08

        <small id='9TSTV'></small><noframes id='9TSTV'>

          • <bdo id='9TSTV'></bdo><ul id='9TSTV'></ul>

              <legend id='9TSTV'><style id='9TSTV'><dir id='9TSTV'><q id='9TSTV'></q></dir></style></legend>

                  <tbody id='9TSTV'></tbody>
                <tfoot id='9TSTV'></tfoot>
                <i id='9TSTV'><tr id='9TSTV'><dt id='9TSTV'><q id='9TSTV'><span id='9TSTV'><b id='9TSTV'><form id='9TSTV'><ins id='9TSTV'></ins><ul id='9TSTV'></ul><sub id='9TSTV'></sub></form><legend id='9TSTV'></legend><bdo id='9TSTV'><pre id='9TSTV'><center id='9TSTV'></center></pre></bdo></b><th id='9TSTV'></th></span></q></dt></tr></i><div id='9TSTV'><tfoot id='9TSTV'></tfoot><dl id='9TSTV'><fieldset id='9TSTV'></fieldset></dl></div>
                本文介绍了如何允许用户编辑 ListBox 中的项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

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

                I want to create a ListBox control that allows the user to edit items, like the list box for extensions in Launchy. Is this possible in WinForms? I tried using Autoit Window Info on that list box and it shows as QWidget (maybe Qt related).

                推荐答案

                尝试使用 ListView 控件,而不是.

                设置其 LabelEdit 属性 为 True 以允许用户编辑项目的名称.

                Set its LabelEdit property to True in order to allow the user to edit the names of the items.

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

                To allow the user to edit the text on a newly-inserted item, you can use the following code:

                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();
                }
                

                这篇关于如何允许用户编辑 ListBox 中的项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:取消 ListBox SelectedIndexChange 事件 下一篇:c# wpf - 不能同时设置 DisplayMemberPath 和 ItemTemplate

                相关文章

                  <small id='nET21'></small><noframes id='nET21'>

                  <i id='nET21'><tr id='nET21'><dt id='nET21'><q id='nET21'><span id='nET21'><b id='nET21'><form id='nET21'><ins id='nET21'></ins><ul id='nET21'></ul><sub id='nET21'></sub></form><legend id='nET21'></legend><bdo id='nET21'><pre id='nET21'><center id='nET21'></center></pre></bdo></b><th id='nET21'></th></span></q></dt></tr></i><div id='nET21'><tfoot id='nET21'></tfoot><dl id='nET21'><fieldset id='nET21'></fieldset></dl></div>
                  <tfoot id='nET21'></tfoot>
                    <legend id='nET21'><style id='nET21'><dir id='nET21'><q id='nET21'></q></dir></style></legend>
                    • <bdo id='nET21'></bdo><ul id='nET21'></ul>