本文整理汇总了C#中System.Windows.Forms.WebBrowserNavigatingEventHandler代理的典型用法代码示例。如果您正苦于以下问题:C# WebBrowserNavigatingEventHandler代理的具体用法?C# WebBrowserNavigatingEventHandler怎么用?C# WebBrowserNavigatingEventHandler使用的例子?那么恭喜您, 这里精选的代理代码示例或许可以为您提供帮助。
WebBrowserNavigatingEventHandler代理属于System.Windows.Forms命名空间,在下文中一共展示了WebBrowserNavigatingEventHandler代理的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Form1_Load
private void Form1_Load(object sender, EventArgs e)
{
webBrowser1.DocumentText =
"<html><body>Please enter your name:<br/>" +
"<input type='text' name='userName'/><br/>" +
"<a href='http://www.microsoft.com'>continue</a>" +
"</body></html>";
webBrowser1.Navigating +=
new WebBrowserNavigatingEventHandler(webBrowser1_Navigating);
}
private void webBrowser1_Navigating(object sender,
WebBrowserNavigatingEventArgs e)
{
System.Windows.Forms.HtmlDocument document =
this.webBrowser1.Document;
if (document != null && document.All["userName"] != null &&
String.IsNullOrEmpty(
document.All["userName"].GetAttribute("value")))
{
e.Cancel = true;
System.Windows.Forms.MessageBox.Show(
"You must enter your name before you can navigate to " +
e.Url.ToString());
}
}