-1

我正在寻找一个非常简单的程序,它的唯一功能是显示我的网站。所以基本上该程序就像网站的 iframe。实现这一目标的最佳方法是什么?

4

1 回答 1

2

您不能使用 iFrame,因为它是一种浏览器技术。你必须使用如下的网络浏览器,我相信:

using System;
using System.Windows.Forms;

namespace WindowsFormsApplication10
{
    public partial class Form1 : Form
    {
    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        // When the form loads, open this web page.
        webBrowser1.Navigate("http://www.dotnetperls.com/");
    }

    private void webBrowser1_Navigating(object sender, WebBrowserNavigatingEventArgs e)
    {
        // While the page has not yet loaded, set the text.
        this.Text = "Navigating";
    }

    private void webBrowser1_DocumentCompleted(object sender,
        WebBrowserDocumentCompletedEventArgs e)
    {
        // Better use the e parameter to get the url.
        // ... This makes the method more generic and reusable.
        this.Text = e.Url.ToString() + " loaded";
    }
    }
}

参考。http://www.dotnetperls.com/webbrowser

注意:示例在 C# 中。

看看这个 C++什么是 C++ 项目的嵌入式浏览器?

于 2012-09-13T17:47:24.470 回答