Compartir a través de


How to: Use the Animation Region of the Status Bar

The Animation region of the Visual Studio status bar displays a looping animation that indicates either a lengthy operation or an operation of indeterminate length (for example, building multiple projects in a solution).

To use the Animation region of the Visual Studio status bar

  1. Obtain an instance of the IVsStatusbar interface, which is made available through the SVsStatusbar service.

  2. Start the animation by calling the Animation method of the status bar. Pass in 1 as the value of the first parameter, and a reference to an animated icon as the value of the second parameter.

  3. Stop the animation by calling the Animation method of the status bar. Pass in 0 as the value of the first parameter, and a reference to the animated icon as the value of the second parameter.

Example

This example demonstrates how to run a built-in animation in the Animation region.

Private Sub AnimationExample()
    Dim statusBar As IVsStatusbar = CType(GetService(GetType(SVsStatusbar)), IVsStatusbar)
    Dim icon As Object = CShort(Fix(Microsoft.VisualStudio.Shell.Interop.Constants.SBAI_General))

    ' Display the animated Visual Studio icon in the Animation region.
    statusBar.Animation(1, icon)

    System.Windows.Forms.MessageBox.Show("Click OK to end status bar animation.")

    statusBar.Animation(0, icon)
End Sub
void AnimationExample()
{
    IVsStatusbar statusBar = 
        (IVsStatusbar)GetService(typeof(SVsStatusbar));
    object icon = 
        (short)Microsoft.VisualStudio.Shell.Interop.Constants.SBAI_General;

    // Display the animated Visual Studio icon in the Animation region.
    statusBar.Animation(1, ref icon);

    System.Windows.Forms.MessageBox.Show(
        "Click OK to end status bar animation.");

    statusBar.Animation(0, ref icon);
}

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: Program the Designer Region of the Status Bar

Other Resources

Status Bar