2

I am just wondering if there is any approach to catch only some part of the web page using WPF and show up it?

Any ideas?

Thank you!

2
  • 1
    Like go into the HTML and only take a part of the HTML out and stick it in the browser control? Feb 10, 2012 at 13:55
  • @Hexxagonal Yeah... Do you have any stupid sample how to do it?
    – NoWar
    Feb 10, 2012 at 13:57

2 Answers 2

1

You will need to reference SHDocVw.dll. From there, it is a matter of casting WebBrowser.Document to MSHTML.IHTMLDocument2 and using IntelliSense to figure out how to access the DOM and remove what you don't want.

0

Here is my solution.

mshtml.IHTMLDocument2 doc = (IHTMLDocument2)MainBrowser.Document;

if (null != doc)
{
     foreach (IHTMLElement element in doc.all)
     {
           if (element.id == "wrapper")
           {
                 HTMLDivElement container = element as HTMLDivElement;

                 dynamic dd = container;

                 string result = dd.IHTMLElement_innerHTML;

                 // You get ANY member of HTMLDivElementClass

                  break;
             }
     }
}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.