Implementation of Transparent browser window

Source: Internet
Author: User

First look at the effect chart:

This implementation is based on the Wpf,vs version 2008 SP1.

Let's start with the implementation in WinForm: It's simple to do by setting the opacity of a form, or you can set up Transparentkey to make a color transparent. But how do you implement it in WPF?

By setting the opacity of the form, the result is that the WebBrowser whole disappears. Because this involves the issue of "airspace" in WPF, the relevant articles are as follows:

Http://blogs.msdn.com/changov/archive/2009/01/19/webbrowser-control-on-transparent-wpf-window.aspx

It seems that by directly setting the transparency method is not, then back to the original question, "the browser form background to transparent", in fact, the transparency here is just a visual feeling, is the browser in the background of the Web page and the entire form of the background want to integrate. See here, you reader may have thought of it, the background of the page in the browser is drawn to the browser control covered by the background on it. Indeed, my realization is also in accordance with this way of thinking.

Two technologies are used here:

L MSHTML manipulate the elements in the Web page to draw the background by adding behavior to the body tag.

[ComVisible(true), Guid("0015EC28-C85F-49a8-9B1A-DC91E6345274"),
    ClassInterface(ClassInterfaceType.AutoDispatch)]
    public class MyGadgetBodyBehavior : IElementBehavior, IHTMLPainter
    {
        public delegate void SizeChangedEventHandler(SizeChangedEventArgs e);
        public event SizeChangedEventHandler onSizeChangedEvent;
        private AppScreenSnapHelper snapHelper;

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.