This document is archived and information here might be outdated.  Recommended version.


Animation Progressor Snippet (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference

Animation Progressor Snippet

Play the default animation progressor on the status bar while�messages are shown.

[C#]
/// <summary>
/// Play the default animation progressor on the status bar while�messages are shown.
/// </summary>
/// <param name="application">An IApplication interface.</param>
/// <param name="stopLoop">An Int32 that is the ending counter in the loop to display in the animation progressor. Example: 30000</param>
/// <remarks>The status bar gives users an indication that the appplication is processing.</remarks>
public void AnimationProgressor(ESRI.ArcGIS.Framework.IApplication application, System.Int32 stopLoop)
{

    ESRI.ArcGIS.esriSystem.IStatusBar statusBar=application.StatusBar;
    ESRI.ArcGIS.esriSystem.IAnimationProgressor animationProgressor=statusBar.ProgressAnimation;

    animationProgressor.Show();
    animationProgressor.Play(0, -1, -1);

    System.Int32 iteration=0;

    for (iteration=0; iteration <= stopLoop; iteration++)
    {
        // TODO: Add your code here to do things like: read or copy files, draw point moving on the screen, etc.
        // ...

        statusBar.set_Message(0, "Counting..." + iteration.ToString());
    }

    animationProgressor.Stop();
    animationProgressor.Hide();

}
[Visual Basic .NET]
''' <summary>
''' Play the default animation progressor on the status bar while�messages are shown.
''' </summary>
''' <param name="application">An IApplication interface.</param>
''' <param name="stopLoop">An Int32 that is the ending counter in the loop to display in the animation progressor. Example: 30000</param>
''' <remarks>The status bar gives users an indication that the appplication is processing.</remarks>
Public Sub AnimationProgressor(ByVal application As ESRI.ArcGIS.Framework.IApplication, ByVal stopLoop As System.Int32)

  Dim statusBar As ESRI.ArcGIS.esriSystem.IStatusBar=application.StatusBar
  Dim animationProgressor As ESRI.ArcGIS.esriSystem.IAnimationProgressor=statusBar.ProgressAnimation

  animationProgressor.Show()
  animationProgressor.Play()

  Dim iteration As System.Int32=0

  For iteration=0 To stopLoop
    ' TODO: Add your code here to do things like: read or copy files, draw point moving on the screen, etc.
    ' ...

    statusBar.Message(0)="Counting..." + iteration.ToString
  Next

  animationProgressor.Stop()
  animationProgressor.Hide()

End Sub

Additional Requirements
  • The code in this document requires the following References added to the Visual Studio project:
  • ESRI.ArcGIS.Framework
  • ESRI.ArcGIS.System