I want to add click event of webBrowser control. This is my code.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
HtmlDocument htmlDoc;
public Form1()
{
InitializeComponent();
OpenFileDialog open = new OpenFileDialog();
open.ShowDialog();
this.webBrowser1.Navigate(open.FileName);
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if (webBrowser1.Document != null)
{
htmlDoc = webBrowser1.Document;
htmlDoc.Click += new HtmlElementEventHandler(htmlDoc_Click);
}
}
private void htmlDoc_Click(object sender, HtmlElementEventArgs e)
{
MessageBox.Show("Click");
}
}
}
I want it to diplay a .ppt file. It is ok to display but when I click the webBrowser there is no messagebox show up. Is there any other solution? thanks