ListView 和 BeginEdit 方法

发布于 2024-12-06 08:07:20 字数 431 浏览 7 评论 0原文

我有一个列表视图。当我调用 listview.SelectedItems[0].BeginEdit() 时,它能够更正所选项目。当我结束编辑我的项目时,例如按“Enter”等按钮,需要调用什么事件?

首先,当用户选择 ToolStripMenuItem 时,会发生以下事件:

private void renameLocalUserToolStripMenuItem_Click(object sender, EventArgs e)
{
    if (listView_ad.SelectedItems.Count > 0)
    {
        listView_ad.SelectedItems[0].BeginEdit();
    }
}

当用户结束更改其项目时,他按“enter”键。然后我需要获取更改后的文本。

I have a ListView. When I call listview.SelectedItems[0].BeginEdit(), it is able to correct the selected item. What event needs to be called, when I end edit my item, for example, press such button as "Enter"?

At first, when the user selects ToolStripMenuItem it is occurs so event:

private void renameLocalUserToolStripMenuItem_Click(object sender, EventArgs e)
{
    if (listView_ad.SelectedItems.Count > 0)
    {
        listView_ad.SelectedItems[0].BeginEdit();
    }
}

When the user ends changing his item, he presses "enter". And then I need to take the changed text.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

黄昏下泛黄的笔记 2024-12-13 08:07:20

使用“AfterLabelEdit”事件。

MSDN标签编辑后

Use the 'AfterLabelEdit' event.

MSDN AfterLabelEdit

余厌 2024-12-13 08:07:20

您的问题不太清楚,但我认为您需要的是处理 AfterLabelEdit 事件。

Your question is not quite clear, but I think what you need is to handle the AfterLabelEdit event.

念﹏祤嫣 2024-12-13 08:07:20

您可能正在寻找 AfterLabelEdit 事件。

You may be looking for the AfterLabelEdit event.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文