Pergunta

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?

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top