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;