【问题标题】:How to show progress in the System Tray如何在系统托盘中显示进度
【发布时间】:2013-03-20 02:59:19
【问题描述】:

我正在尝试在系统托盘中显示进度。我用这个:

    ProgressIndicator pi = new ProgressIndicator();
    SystemTray.ProgressIndicator = pi;
    SystemTray.ProgressIndicator.IsIndeterminate = false;

我遇到的问题是更改进度指示器的最大值。默认值似乎是一个,但我看不出有什么办法改变它。你会怎么做?

【问题讨论】:

    标签: c# windows-phone-7 windows-phone-8 progress system-tray


    【解决方案1】:

    ProgressIndicator 采用的是介于0 和1 之间的double 值。

    如果您想将任何其他数字放入其中(例如 0 到 100),您需要做的是 normalise 值,这会将它们带入范围 0-1。

    例如你会这样做:

    double progress = 0.0;
    double max = 100.0;
    
    progress = 0.0/max;  // = 0.0
    pi.Value = progress;
    
    progress = 50.0/max; // = 0.5
    pi.Value = progress;
    
    progress = 100.0/max; // = 1.0
    pi.Value = progress;
    

    你会输入0 and 1之间的值。

    Here is a good little post关于这个功能。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多