Doubleclicking tab control header

折月煮酒 提交于 2019-12-22 10:53:56

问题


I've been wondering about this problem for some time - doubleclicking a winforms TabControl's header doesn't get detected, but I'd like to handle this event.

It looks like all mouse events (click,move,etc.) don't get raised when they are on the 'inactive' area of TabControl. I've even tried subclassing TabControl, but the derived class' events aren't raised too. Overriding WndProc shown that it doesn't receive WM_LBUTTONDBLCLK message (I mean - WTF?).

Thanks. But I'm sure that the tab control knows that I've clicked on its header, it just doesn't let me know.

p.s. I've looked at .NET : Double-click event in TabControl - but nothing


回答1:


Hm...I did a test project and I am getting both MouseDoubleClick and DoubleClick events. What do you mean by "Tabcontrol's header"? An actual tab or the blank area were additional tabs would show?

I used eventspy.zip

If you mean the blank area (which you do by the comment) then no, because there is nothing in the blank area. No control. What you need to do is put the TabControl in a Panel, and set the TabControl's Dock property to Fill. Handle the Panel's double-click events.



来源:https://stackoverflow.com/questions/2371969/doubleclicking-tab-control-header

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