HtmlDocument.Stop Event

 

Occurs when navigation to another Web page is halted.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public event HtmlElementEventHandler Stop

The loading of a Web page will halt if program code calls the Stop method of the WebBrowser control. Navigation failures caused by network outages or malfunctioning Web sites will not cause Stop to occur.

For more information about handling events, see Handling and Raising Events.

The following code example resets the status bar on a Windows Forms application when the Stop event has occurred. The code example requires that you have a StatusBar control named StatusBar1 in your application.

ContextMenuStrip menuStrip = null;

public void DetectContextMenu()
{
    if (webBrowser1.Document != null)
    {
        webBrowser1.Document.ContextMenuShowing += new HtmlElementEventHandler(Document_ContextMenuShowing);
        menuStrip = new ContextMenuStrip();
        menuStrip.Items.Add("&Custom menu item...");
    }
}

void Document_ContextMenuShowing(object sender, HtmlElementEventArgs e)
{
    menuStrip.Show(e.MousePosition);
    e.ReturnValue = false;
}

.NET Framework
Available since 2.0
Return to top
Show: