문제

I have a WinForm application with tekstbox controls that are connected to a ContextMenuStrip. If I rightclick on a textbox the context menu is (of course) opened. As far as I can see the ContextMenuStrip events don't give any info about the control on which the context menu was opened.

I can't use a work-around by looking at the focused control, as the rightclick doesn't give focus to the textbox (if it hasn't have focus before the rightclick).

So my question is: how can I determine the control on which the context menu was opened?

도움이 되었습니까?

해결책

Contextmenu has a SourceControl property which you should be able to use :)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top