문제

I wonder how can i accomplish the following:

I would like to display the progress of a progressbar on the taskbar while my window is minimized. See here for a visual description.

See how the icon on the taskbar gradually fills with green color following the main progressbar in the window?

Could someone tell me how to do that?

Update:

I downloaded windows api code pack and referenced it in my project and wrote the following code but nothing happens when i run my app increment the pbar and minimize:

    private void updatepbar()
    { 
        tpb.Value = progressBar1.Value;
    }

        timer1.Tick += new EventHandler(delegate { updatepbar(); });
        timer1.Interval = 1000;
        timer1.Start();

What am i doing wrong? thanks alot

도움이 되었습니까?

해결책

http://windowsteamblog.com/windows/b/developers/archive/2009/07/28/windows-7-taskbar-dynamic-overlay-icons-and-progress-bars.aspx

Taskbar.ProgressBar.State = 
(TaskbarButtonProgressState)Enum.Parse(
        typeof(TaskbarButtonProgressState), 
        (string)comboBoxProgressBarStates.SelectedItem);

if (Taskbar.ProgressBar.State != TaskbarButtonProgressState.Indeterminate)
   Taskbar.ProgressBar.CurrentValue = progressBar1.Value;

다른 팁

It's only working for Windows7 and you can just easily use the Microsoft-Api.

Explained with a nice example on WindowsTeamBlog and on MSDN.

You can just use a standard progressbar in your main form - Windows 7 will detect it and mimic it on the taskbar automatically:

From http://windowsteamblog.com/windows/b/developers/archive/2009/07/28/windows-7-taskbar-dynamic-overlay-icons-and-progress-bars.aspx:

If you already use a standard progress bar in your application’s top level window, the DMW will pick it up and, by default, display its progress as an overlay on top of your application. However, you can programmatically control the progress bar behavior on your application’s icon.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top