Link to home
Start Free TrialLog in
Avatar of UdiRaz
UdiRaz

asked on

How to display on a rect in a web page on Microsoft web browser control ?

Hi,
In addition to my previous question.

I hava a web page that contain an image. The image is located on the top left corner right after a company logo that I don't want to display. I created a web browser control with the size of the image. I would like to display the web page with an offset, like the user scroll down and to the right a little.

Regards
Udi Raz
Avatar of DanRollins
DanRollins
Flag of United States of America image

Your best bet would be to remove the image altogether.  In your OnDownloadComplete event, just work through the DOM and remove the IMAGE element that offends you.
Avatar of UdiRaz
UdiRaz

ASKER

Thanks for you help but I don't understand the answer. Can you refer me to an example?
Avatar of UdiRaz

ASKER

I understood this part "Your best bet would be to remove the image altogether.  In your OnDownloadComplete event".

Didn't understand what should I do inside OnDownloadComplete. "just work through the DOM and remove the IMAGE element that offends you."

Please advice
I'm just pointing out that you can't access the DOM until the download is complete.

Since you have a webbrowser control, I assumed that you know how to access the DOM -- using functions such as GetImages() or getElementById() -- then you could find that specific element (the company logo image) and remove it or modify it using, for instance, the innerHTML property.

There is some example code in a number of EE questions, for instance:
   https://www.experts-exchange.com/questions/20194736/Looking-for-a-simple-IWebBrowser2-sample.html

As sson as you make a change using the DOM, the screen immediately redraws showing it with the alterations.
Avatar of UdiRaz

ASKER

What is DOM ?
Avatar of UdiRaz

ASKER

I am not familiar with COM. I just created an activeX control from the Visual Wizard and use it's methods
DOM (Document Object Model) provides a means to examine and modify the content of an HTML document.  Having used the ActiveX webbrowser control to connect to a website and download the content, you can, for instance, learn the URL of every IMG that is displayed on the page.  

You can also make changes to the content.  For instance, you can remove a part of a page that  you don't want to be displayed.  That is what you want to do isn't it?

There are a number of ways to approach the problem, but the simplest programmatically would be to obtain the entire text of the HTML, then look for a specific sequence, such as:
  <IMG src="/images/logo.gif">
You could then remove that part of the HTML (or replace it with a different image) and then set the document to have the modified content.   The result would be that that particular image would not be displayed in your webbrowser control.

Your question was about offsetting the page.  You have not asked about other methods of modifying the content.  Are you interested in exploring the DOM technique i've described?
Avatar of UdiRaz

ASKER

Thanks for your details answer.

As for your last question, because a lack of time ( there is never enough time ), I am not interested in exploring the DOM technique.

Attched, is the webPage. I would like to display only the green image. I don't want our header menu, that made of several elements and a footer bar ( not seen in the image )

In addition, I would like to remove the scroll bar.

Thanks in advance
webPage.JPG
ASKER CERTIFIED SOLUTION
Avatar of DanRollins
DanRollins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial