WebBrowser Click-Event

时间:2015-05-11 13:41:06

标签: c# webbrowser-control screensaver

我想编写一个屏幕保护程序,因为我已经有了HTML5代码,我只想使用一个呈现内容的WebBrowser控件。但是,我无法弄清楚如何在" Click"," Keydown"等事件上退出应用程序.WebBrowser类似乎并不知道这些事件。谁能告诉我如何让我的申请退出?

这里有一些代码:

public Screensaver()
{
    InitializeComponent();

    this.Load += Screensaver_Load;
    StartBrowser();
}

private void StartBrowser()
{
    this.webBrowser1.DocumentText = Content;
}

private void Screensaver_Load(object sender, EventArgs e)
{
    this.FormBorderStyle = FormBorderStyle.None;
    this.Bounds = Screen.PrimaryScreen.Bounds;
    Cursor.Hide();
    this.TopMost = true;
    this.BackColor = Color.White;
    this.webBrowser1.Size = new System.Drawing.Size(this.ClientSize.Width, this.ClientSize.Height);
}

private String Content 
{
    get
    {
        return "<html>..[long html code following]..</html>";
    }
}

1 个答案:

答案 0 :(得分:0)

您可以使用javascript函数关闭浏览器中的当前应用程序,例如:

CXX=icpc  
CFLAGS = -Wall -Ilib -O3 -openmp -std=c++11  
CXXFLAGS = -Wall -Ilib -O3 -openmp -std=c++11 
LDFLAGS= -lz
main: $(patsubst %.cpp,%.o,$(wildcard lib/*.cpp))