WebBrowser.DocumentCompleted イベント
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)

Dim instance As WebBrowser Dim handler As WebBrowserDocumentCompletedEventHandler AddHandler instance.DocumentCompleted, handler
public: event WebBrowserDocumentCompletedEventHandler^ DocumentCompleted { void add (WebBrowserDocumentCompletedEventHandler^ value); void remove (WebBrowserDocumentCompletedEventHandler^ value); }

次のいずれかのプロパティが設定される、またはメソッドが呼び出されると、WebBrowser コントロールは必ず新しいドキュメントに移動します。
DocumentCompleted イベントを処理すると、新しいドキュメントの読み込みが終了したときに通知が送られます。DocumentCompleted イベントが発生したときには、新しいドキュメントが完全に読み込まれています。つまり Document プロパティ、DocumentText プロパティ、または DocumentStream プロパティを使用してドキュメントのコンテンツにアクセスできます。
ナビゲーションを開始する前に通知を受け取るには、Navigating イベントを処理します。このイベントを処理すると、たとえばユーザーがフォームへの入力を完了していない場合など、特定の条件が満たされなかった場合にナビゲーションをキャンセルできます。Navigated イベントを処理すると、WebBrowser コントロールがナビゲーションを完了し、新しい位置でドキュメントの読み込みを開始したときに通知が送られます。

このイベントを使用して、ドキュメントが完全に読み込まれた後にドキュメントを印刷する方法を次のコード例に示します。
Private Sub PrintHelpPage() ' Create a WebBrowser instance. Dim webBrowserForPrinting As New WebBrowser() ' Add an event handler that prints the document after it loads. AddHandler webBrowserForPrinting.DocumentCompleted, New _ WebBrowserDocumentCompletedEventHandler(AddressOf PrintDocument) ' Set the Url property to load the document. webBrowserForPrinting.Url = New Uri("\\myshare\help.html") End Sub Private Sub PrintDocument(ByVal sender As Object, _ ByVal e As WebBrowserDocumentCompletedEventArgs) Dim webBrowserForPrinting As WebBrowser = CType(sender, WebBrowser) ' Print the document now that it is fully loaded. ' webBrowserForPrinting.Print() MessageBox.Show("print") ' Dispose the WebBrowser now that the task is complete. webBrowserForPrinting.Dispose() End Sub
private void PrintHelpPage() { // Create a WebBrowser instance. WebBrowser webBrowserForPrinting = new WebBrowser(); // Add an event handler that prints the document after it loads. webBrowserForPrinting.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(PrintDocument); // Set the Url property to load the document. webBrowserForPrinting.Url = new Uri(@"\\myshare\help.html"); } private void PrintDocument(object sender, WebBrowserDocumentCompletedEventArgs e) { // Print the document now that it is fully loaded. ((WebBrowser)sender).Print(); // Dispose the WebBrowser now that the task is complete. ((WebBrowser)sender).Dispose(); }


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からWebBrowser.DocumentCompleted イベントを検索する場合は、下記のリンクをクリックしてください。

- WebBrowser.DocumentCompleted イベントのページへのリンク