C# Listbox Item Double Click Event

后端 未结 6 761
天命终不由人
天命终不由人 2020-12-08 06:00

I have a list box with some items. Is there anyway I can attach a double click event to each item?

Item 1
Item 2
Item 3

If i was to double

6条回答
  •  孤城傲影
    2020-12-08 06:49

    This is very old post but if anyone ran into similar problem and need quick answer:

    • To capture if a ListBox item is clicked use MouseDown event.
    • To capture if an item is clicked rather than empty space in list box check if listBox1.IndexFromPoint(new Point(e.X,e.Y))>=0
    • To capture doubleclick event check if e.Clicks == 2

提交回复
热议问题