highlighting text in web browser - c#

srd1984

Newcomer
Joined
Jan 7, 2005
Messages
5
I have a MDI application with one window as a web browser and the other as a text editor. When I copy text over , it stores the URL.

Is there a way that when I click on the URL later, it will take me to the webpage, but with the text that was highlighted previously that was copied, remaining highlighted. So if a webpage contains the text "hello world" and i copied it over and i go back to it, the hello world should still be highlighted?

If possible using different colours for different highlighted text but thats an optional extra

I found the following bits of code of google groups but I coulndt understand how to use them:

mshtml.IHTMLDocument2 HTMLDocument;
HTMLDocument htmlDocument = (mshtml.IHTMLDocument2) browserComp.Document;
mySelection = htmlDocument.selection.ToString();
this.myTextRange = (mshtml.IHTMLTxtRange)mySelection.createRange();
myText = myTextRange.text;


AND I found this:

IHTMLTxtRange range = (IHTMLTxtRange)
dhtmlEditor.DOM.selection.createRange();
String highlighted = range.text;


As you can see I am currently using the axwebbrowser component, however I know c# express has the new WebBrowser component so if its easier to do it in that, I am willing to use that if anybody know the code.

Thank you for any help you can provide.
 
Back
Top