Search code examples
c#.netwebbrowser-controlhighlighting

trying to highlight words in WebBrowser control


i am trying to make my WebBrowser control highlight some words. i found this example but i don't get how to translate that to c#. any help would be appreciated :)


Solution

  • The code is already in C#. You need to add a reference to get the interface type definitions. They are COM types, imported from an Internet Explorer type library.

    Project + Add Reference, Browse tab, select c:\windows\system32\mshtml.tlb. Put using mshtml; at the top of your source code file. The code is pretty sloppy with the COM types, if you use VS2010 then you'll have to select the added reference (MSHTML) in the References node and set the Embed Interop Types property to False and the Copy Local property to True. Deploy the Microsoft.mshtml.dll interop library you'll find the build directory along with your program.