日期:2014-05-18  浏览次数:20936 次

谁能解决?——获得ContextMenuStrip关联的控件
我自定义一个Menu继承自contextmenustrip,现在我要在自己的Menu里面获得当前绑定到哪个控件上了。如何获得?

例:我从工具栏拖上一个ContextMenuStrip contextMenuA 然后设置界面上的一个DataGridView 的ContextMenuStrip属性为 :contextMenuA
 然后我要在ContextMenuA【对象里面】获得其关联的DataGridView【对象】。

------解决方案--------------------
contextMenuStrip1.SourceControl