Imports Microsoft.WindowsAPICodePack.Taskbar
Public Class frmProgressbar
Private Sub frmProgressbar_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
cmbProgressState.Items.AddRange([Enum].GetNames(GetType(TaskbarProgressBarState)))
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkRun.CheckedChanged
Timer1.Enabled = chkRun.Checked
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If Progress.Value = Progress.Maximum Then Progress.Value = 0
Progress.Value += 1
End Sub
Private Sub Progress_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Progress.ValueChanged
ProgressBar1.Maximum = Progress.Maximum
ProgressBar1.Value = Progress.Value
TaskbarManager.Instance.SetProgressValue(Progress.Value, Progress.Maximum, Me.Handle)
End Sub
Private Sub cmbProgressState_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmbProgressState.TextChanged
chkRun.Checked = False 'changing the value of the progress bar after setting the state to NoProgress or indeterminate will have no visible effect
TaskbarManager.Instance.SetProgressState([Enum].Parse(GetType(TaskbarProgressBarState), cmbProgressState.Text), Me.Handle)
End Sub
End Class