Επεξεργασία

Κοινή χρήση μέσω


TaskbarItemInfo.ProgressValue Property

Definition

Gets or sets a value that indicates the fullness of the progress indicator in the taskbar button.

public:
 property double ProgressValue { double get(); void set(double value); };
public double ProgressValue { get; set; }
member this.ProgressValue : double with get, set
Public Property ProgressValue As Double

Property Value

A value that indicates the fullness of the progress indicator in the taskbar button. The default is 0.

Examples

The following example shows how to set the ProgressValue property in code. The value is set in the handler of a BackgroundWorker.ProgressChanged event to indicate the current progress of the background task. This example is part of a larger example provided for the TaskbarItemInfo class.

void bw_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
    this.tbCount.Text = e.ProgressPercentage.ToString();
    // Update the value of the task bar progress indicator.
    this.taskBarItemInfo1.ProgressValue = (double)e.ProgressPercentage / 100;
}
Private Sub bw_ProgressChanged(ByVal sender As Object, ByVal e As ProgressChangedEventArgs)
    Me.tbCount.Text = e.ProgressPercentage.ToString()
    ' Update the value of the task bar progress indicator.
    Me.taskBarItemInfo1.ProgressValue = e.ProgressPercentage / 100
End Sub

Remarks

The ProgressValue property is represented as a value between 0.0 and 1.0. Numbers smaller and larger are coerced to be within those bounds. NaN is coerced to 0.

You can communicate the progress of long-running tasks by displaying a progress indicator in a Windows 7 taskbar button. The color of the indicator is determined by the ProgressState property, which contains one of the TaskbarItemProgressState enumeration values. If the ProgressState property is Normal, Paused, or Error, the ProgressValue property determines the fullness of the progress indicator. ProgressValue is ignored for some values of ProgressState. Indeterminate shows a pulsing green indicator across the entire taskbar button. No indicator is shown for None.

The following illustration shows the taskbar progress indicator with a ProgressValue of 82 percent.

Taskbar Item Info Sample
Windows Taskbar Progress Indicator

Applies to