本文整理匯總了C#中System.Windows.Forms.WebBrowserNavigatingEventArgs類的典型用法代碼示例。如果您正苦於以下問題:C# WebBrowserNavigatingEventArgs類的具體用法?C# WebBrowserNavigatingEventArgs怎麽用?C# WebBrowserNavigatingEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
WebBrowserNavigatingEventArgs類屬於System.Windows.Forms命名空間,在下文中一共展示了WebBrowserNavigatingEventArgs類的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());
}
}