Click here to Skip to main content
15,891,633 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey, I am creating a web browser which is a bit like chrome/ ie in the sense that I want the context menu strip to change once a link is hovered upon.

So when you right click on a link it displays a different context menu to the one before if no link has the mouse hovered on them.

Thanks in advance!

Basically when a link is hovered upon I would like to see if it is a link and if it is then to change the web browser's context menu
Posted

1 solution

The context menu should be in only on instance, but the items can be modified in the handler of System.Windows.Controls.ContextMenu.ContextMenuOpening, if you use Forms. For WPF, it will be a handler of the event System.Windows.Controls.ContextMenu.ContextMenuOpening.

Please see my answer to a very similar question:
contextMenu based on xml element in treeView[^]

—SA
 
Share this answer
 
Comments
dan!sh 1-May-11 0:13am    
OP's comment: no sorry that's not it Frown | :(

What I want is to know if the mouse position in the document is on a link and if so then do some code.

like so if(.......)
{
}
hugheb 1-May-11 15:03pm    
no sorry thats not it

like so if(.......)
{
}
Sergey Alexandrovich Kryukov 1-May-11 15:37pm    
??????
hugheb 1-May-11 16:18pm    
whoops accident

Sorry -- you misunderstood - I would like code to know if the mouse is hovering on a link in the web browser document.

Thanks
Sergey Alexandrovich Kryukov 1-May-11 17:00pm    
Yes, I misunderstood; as you mentioned "different context menus" I thought this is about making them different; sorry about that.

See this discussion on hovering:
http://stackoverflow.com/questions/608788/css-hover-vs-javascript-mouseover.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900