WebBrowser のコンテキスト メニューをキャンセルする例を次に示します。これは先に進むのに役立ちます:
// wb = WebBrowser control instance name
// attach to the DocumentCompleted event
wb.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(wb_DocumentCompleted);
void wb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
// when the document loading is completed, attach to the document context showing event
wb.Document.ContextMenuShowing += new HtmlElementEventHandler(Document_ContextMenuShowing);
}
void Document_ContextMenuShowing(object sender, HtmlElementEventArgs e)
{
// cancel showing context menu
e.ReturnValue = false;
// take a look at the 'e' parameter for everything else, you can get various information out of it
}