Status Bar

The Visual Studio status bar, the horizontal region at the bottom of the Visual Studio design surface, provides a convenient way to convey information about the current state of the integrated development environment (IDE). The status bar comprises four programmable regions, as shown in the following table:

Region

Description

Feedback

Displays text. You can set and retrieve text, display static text, and highlight the displayed text.

Progress Bar

Displays incremental progress for quick operations, such as saving a single file to disk.

Animation

Displays a continuously looped animation, which indicates either a lengthy operation or an operation of indeterminate length (for example, building multiple projects in a solution).

Designer

Displays information pertinent to editing, such as the line number or column number of the cursor location.

The status bar's functionality is available to any client object at any time through the IVsStatusbar interface, which is offered by the SVsStatusbar service. In addition, any object sited on a window frame can register as a status bar client object by implementing the IVsStatusbarUser interface. Whenever a window is activated, Visual Studio queries the object sited on that window for the IVsStatusbarUser interface. If found, Visual Studio calls the SetInfo method on the returned interface, and the object can update the status bar from within that method. Document windows, for example, can use the SetInfo method to update information in the Designer region when they become active.

Example

Description

This example demonstrates how to display highlighted text in the Feedback region.

Code

Private Sub SetColorTextExample()
    Dim statusBar As IVsStatusbar = CType(GetService(GetType(SVsStatusbar)), IVsStatusbar)
    Dim uiShell2 As IVsUIShell2 = CType(GetService(GetType(SVsUIShell)), IVsUIShell2)
    Dim frozen As Integer

    statusBar.IsFrozen(frozen)

    If frozen = 0 Then
        ' SetColorText only displays white text on a 
        ' dark blue background.
        statusBar.SetColorText("Here's some highlighted text", 0, 0)
        System.Windows.Forms.MessageBox.Show("Pause")
        statusBar.SetText("Done")
    End If
End Sub
void SetColorTextExample()
{
    IVsStatusbar statusBar = 
        (IVsStatusbar)GetService(typeof(SVsStatusbar));
    IVsUIShell2 uiShell2 = (IVsUIShell2)GetService(typeof(SVsUIShell));
    int frozen;

    statusBar.IsFrozen(out frozen);

    if (frozen == 0)
    {
        // SetColorText only displays white text on a 
        // dark blue background.
        statusBar.SetColorText("Here's some highlighted text", 0, 0);
        System.Windows.Forms.MessageBox.Show("Pause");
        statusBar.SetText("Done");
    }
}

See Also

Tasks

How to: Read from and Write to the Feedback Region of the Status Bar

How to: Program the Progress Bar Region of the Status Bar

How to: Use the Animation Region of the Status Bar

How to: Program the Designer Region of the Status Bar