Home All Groups Group Topic Archive Search About
Author
25 Mar 2010 8:11 AM
Nikos
Is it possible to show different context menus by right clicking
on different areas of a picturebox f.e. ?

An option is to build all the menus as subitems of the the main
context menu and hide/unhide them with the visible method.
Is there an other option on doing this?

Thanks in advance,
/\/ikos

Author
25 Mar 2010 12:08 PM
Armin Zingler
Am 25.03.2010 09:11, schrieb Nikos:
> Is it possible to show different context menus by right clicking
> on different areas of a picturebox f.e. ?
>
> An option is to build all the menus as subitems of the the main
> context menu and hide/unhide them with the visible method.
> Is there an other option on doing this?

ContextMenu or ContextMenuStrip?

With ContextMenuStrip: Handle it's opening event:

   Private Sub ContextMenuStrip1_Opening(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) _
      Handles ContextMenuStrip1.Opening

      Dim p = DirectCast(sender, ContextMenuStrip).SourceControl.PointToClient(Cursor.Position)

      'Modify the ContextMenu here depending on p.

   End Sub

Maybe there's already property in the ContextMenuStrip that reveals the position inside
the SourceControl,  but I couldn't find it.


--
Armin