Silverlight中嵌入Web页面

            HtmlElement Div;
            HtmlElement Iframe;

            Div = HtmlPage.Document.CreateElement("div");
            HtmlElement Form1 = HtmlPage.Document.GetElementById("form1");

            Form1.AppendChild(Div);
            Div.SetStyleAttribute("ID", "EmbeddedBrowser1");
            Div.SetStyleAttribute("position", "absolute");
            Div.SetStyleAttribute("top", "100px");
            Div.SetStyleAttribute("left", "100px");
            Div.SetStyleAttribute("width", "1000px");
            Div.SetStyleAttribute("height", "1000px");

            Iframe = HtmlPage.Document.CreateElement("iframe");
            Div.AppendChild(Iframe);
            Iframe.SetAttribute("ID", "EmbeddedBrowserIframe1");

            Iframe.SetStyleAttribute("top", "0px");
            Iframe.SetStyleAttribute("left", "0px");
            Iframe.SetStyleAttribute("width", "1000px");
            Iframe.SetStyleAttribute("height", "1000px");

            Iframe.SetAttribute("src", "http://www.baidu.com");

你可能感兴趣的:(Silverlight中嵌入Web页面)