-1

I want to program a screensaver and since I already have the HTML5 Code I just want to use a WebBrowser Control which renders the content. However I can't figure out how to exit the application on events like "Click", "Keydown", etc. WebBrowser class doesn't seem to know those events. Can anyone tell me how I can make my application exit?

Here's some code:

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>";
    }
}
FRules
  • 739
  • 1
  • 10
  • 20

1 Answers1

0

you can use javascript function to close current application in browser for example:

  <a href="#" onclick="close_window();return false;">close</a>
Niraj
  • 775
  • 7
  • 20