代码之家  ›  专栏  ›  技术社区  ›  Reto Meier

WinForms-活动指示器

  •  2
  • Reto Meier  · 技术社区  · 15 年前

    -这是一直在进行,循环。用户不需要知道迭代何时开始或结束。

    我在想一些小的,方形的,循环的动画。类似于Mac/iPhone应用程序中经常使用的分段“微调器”。

    spinner http://img12.imageshack.us/img12/4402/spinner.png

    是否有类似想法的内置WinForms控件?如果没有,最好的方法是什么?

    3 回复  |  直到 15 年前
        1
  •  24
  •   Glorfindel Doug L.    6 年前

    随便说说 animated GIF 在窗体上,并确保未阻止UI线程:

    alt text

        2
  •  2
  •   Chris Weber Lasse V. Karlsen    7 年前

    public void DoWork()
    {
      try
      {
         this.Cursor = Cursors.WaitCursor;
         DoSomeBigThing();
         . . . .
      }
      catch()
      {
          . . . ..
      }
      finally
      {
          . . . .
          this.Cursor = Cursors.Default;
      }
    }
    
    1. 使用一些免费工具(Google或Bing)创建自己的鼠标光标(.cur文件)
    2. 使用 AutoWaitCursor 并将鼠标光标设置为自己创建的光标

        3
  •  1
  •   Magnus Johansson    15 年前

    使用自定义开发的线程模型或 BackgroundWorker .

    让后台线程使用委托处理程序、考虑线程安全或使用 ProgressChanged 事件,如果您正在使用BackgroundWorker。