.NET : Double-click event in TabControl

时光毁灭记忆、已成空白 提交于 2019-12-23 10:24:14

问题


I would like to intercept the event in a .NET Windows Forms TabControl when the user has changed tab by double-clicking the tab (instead of just single-clicking it).

Do you have any idea of how I can do that?


回答1:


The MouseDoubleClick event of the TabControl seems to respond just fine to double-clicking. The only additional step I would do is set a short timer after the TabIndexChanged event to track that a new tab has been selected and ignore any double-clicks that happen outside the timer. This will prevent double-clicking on the selected tab.




回答2:


For some reason, MouseDoubleClick, as suggested by Jason Z is only firing when clicking on the tabs and clicking on the tab panel does not do anything, so that's exactly what I was looking for.




回答3:


How about subclassing the TabControl class and adding your own DoubleClick event?



来源:https://stackoverflow.com/questions/32733/net-double-click-event-in-tabcontrol

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!