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中的状态栏。 此示例要求窗体包含一个 WebBrowser 调用 webBrowser1 的控件和一个名为 StatusBarStatusBar1控件。

有关完整的代码示例,请参阅 How to: Add Web Browser Capabilities to a Windows 窗体 Application

// 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更改时更新状态栏的事件。

适用于

另请参阅