Context Menus


N

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
 
Ad

Advertisements

A

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top