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
C++
Last Comment
DanRollins
8/22/2022 - Mon
DanRollins
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.
UdiRaz
ASKER
Thanks for you help but I don't understand the answer. Can you refer me to an example?
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."
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.
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?
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.