From: Nikos on
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
From: Armin Zingler on
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