I am trying to add a Context Menu to an ActiveX control (LeadTools Image Control) that I have on my main form. I have tried two different approaches that don't seem to work.
1.Since the control is wrapped using the AxHost class, I tried setting the ContextMenu property (which doesn't show up in design mode for some reason, so I had to set it manually) to my context menu.
axLEADImage.ContextMenu = contextMenuLead;
This did nothing. However if I do this to a normal control, it works fine on a right-click.
2. I also tried calling the ContextMenu.Show method within the MouseButtonUp event on the ActiveX control.
private void OnAxLeadMouseUp(object sender, AxLEADLib._DLeadEvents_MouseUpEvent e)
{
AxLEADLib.AxLEAD AxLead = (AxLEADLib.AxLEAD)sender;
if(e.button == 2) //Lead Tools Right Mouse Button
{
contextMenuLead.Show(AxLead, new Point(e.x, e.y));
}
}
This actually displays the ContextMenu as desired, but all the MenuItems are disabled even though their properties are set to enabled. Any Suggestions as to what I am doing wrong?
1.Since the control is wrapped using the AxHost class, I tried setting the ContextMenu property (which doesn't show up in design mode for some reason, so I had to set it manually) to my context menu.
axLEADImage.ContextMenu = contextMenuLead;
This did nothing. However if I do this to a normal control, it works fine on a right-click.
2. I also tried calling the ContextMenu.Show method within the MouseButtonUp event on the ActiveX control.
private void OnAxLeadMouseUp(object sender, AxLEADLib._DLeadEvents_MouseUpEvent e)
{
AxLEADLib.AxLEAD AxLead = (AxLEADLib.AxLEAD)sender;
if(e.button == 2) //Lead Tools Right Mouse Button
{
contextMenuLead.Show(AxLead, new Point(e.x, e.y));
}
}
This actually displays the ContextMenu as desired, but all the MenuItems are disabled even though their properties are set to enabled. Any Suggestions as to what I am doing wrong?