Get the item doubleclick event of listview

后端 未结 16 1479
没有蜡笔的小新
没有蜡笔的小新 2020-12-01 02:17

What do I need to do in order to reference the double click event for a listview control?

16条回答
  •  感动是毒
    2020-12-01 02:30

    I found this on Microsoft Dev Center. It works correctly and ignores double-clicking in wrong places. As you see, the point is that an item gets selected before double-click event is triggered.

    private void listView1_DoubleClick(object sender, EventArgs e)
    {
        // user clicked an item of listview control
        if (listView1.SelectedItems.Count == 1)
        {
            //do what you need to do here            
        }
    }
    

    http://social.msdn.microsoft.com/forums/en-US/winforms/thread/588b1053-8a8f-44ab-8b44-2e42062fb663

提交回复
热议问题