Make the webbrowser control embedded in the form borderless

Source: Internet
Author: User

AProgramThe main interface of the program is designed on a webpage. The effect is very good. html + CSS can be used to achieve richer interface effects, which is easier than using Delphi directly.

The implementation method is very simple. Add a webbrowser component in the form, and then execute the followingCode:

Webbrowser1.navigate ('d: \ soft \ homepage.html ');

However, a problem arises: The webbrowser component has no borders before loading html. After loading HTML, a three-dimensional border appears around webbrowser, it is extremely different from the style of the program itself, and all attributes of webbrowser are viewed. No attributes can be changed.

After testing, we found that this border is not produced by webbrowser, but by HTML loaded in webbrowser. If so, the problem will be solved. We can actually remove the border with CSS:

Body {border: 0px; overflow: auto;/* the scroll bar can be automatically hidden or displayed; set it to hidden to completely hide the scroll bar */}

When you are happy to set the above CSS, you find that the webbrowser border still exists. Is it CSS wrong? No, your doctype is faulty. The above CSS is ineffective in XHTML. Set doctype to html4:

<! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en">

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.