WebBrowser.StatusText 属性

定义

获取 WebBrowser 控件的状态文本。

public:
 virtual property System::String ^ StatusText { System::String ^ get(); };
[System.ComponentModel.Browsable(false)]
public virtual string StatusText { get; }
[<System.ComponentModel.Browsable(false)>]
member this.StatusText : string
Public Overridable ReadOnly Property StatusText As String

属性值

状态文本。

属性

例外

WebBrowser 实例不再有效。

未能从基础 ActiveX IWebBrowser2 控件检索到对 WebBrowser 接口的实现的引用。

示例

下面的代码示例演示如何使用 StatusText 属性实现 WebBrowser 控件的状态栏,类似于 Internet Explorer 中的状态栏。 此示例要求窗体包含名为 WebBrowserwebBrowser1 控件和 StatusBar 名为 的 StatusBar1控件。

有关完整的代码示例,请参阅如何:向Windows 窗体应用程序添加 Web 浏览器功能

// Updates StatusBar1 with the current browser status text.
void WebBrowser1_StatusTextChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ )
{
   this->StatusBar1->Text = WebBrowser1->StatusText;
}
// Updates the status bar with the current browser status text.
private void webBrowser1_StatusTextChanged(object sender, EventArgs e)
{
    toolStripStatusLabel1.Text = webBrowser1.StatusText;
}
' Updates the status bar with the current browser status text.
Private Sub webBrowser1_StatusTextChanged( _
    ByVal sender As Object, ByVal e As EventArgs) _
    Handles webBrowser1.StatusTextChanged

    toolStripStatusLabel1.Text = webBrowser1.StatusText

End Sub

注解

可以使用此属性在状态栏中显示控件的状态 WebBrowser 。 状态文本是一条消息,其中包含鼠标指针悬停在超链接上的 URL 等信息,以及当前正在加载的文档的 URL。 处理 事件以 StatusTextChanged 在属性值更改时 StatusText 更新状态栏。

适用于

另请参阅