在C#任务栏上的Windows 7进度条? [英] Windows 7 progress bar in taskbar in C#?

查看:138
本文介绍了在C#任务栏上的Windows 7进度条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您在Windows 7测试发现,如果复制文件或其它系统操作,在任务栏的Windows资源管理器图标,将填补了一个相当于表上的进度条绿色的进度条。有没有一种方法是,在我的C#的形式,我可以强迫我的任务栏上的进度条,以配合我做什么工作的进展如何?转换,转让,发电,也有对进度条这么多的用途。

If you've noticed in the Windows 7 beta, if you copy files or other system actions, the windows explorer icon in the taskbar will fill up with a green progress bar equivalent to the progress bar on the form. Is there a way that, in my C# forms, I can force my taskbar progress bar to match the progress of whatever task I'm doing? Converting, transferring, generating, there are so many uses for that progress bar.

推荐答案

谁的人想跳过阅读文档和刚刚获得一些作品...

For people who want to skip reading the documentation and just get something that works...


  • 下载的的Windows API代码包对于Microsoft .NET Framework

  • 运行它创建了一个zip文件

  • 安装
  • 从zip文件的二进制文件夹中提取下列DLL:

    • Microsoft.WindowsAPICodePack.dll

    • Microsoft.WindowsAPICodePack.Shell.dll

    • Download the Windows API Code Pack for Microsoft .Net Framework.
    • Run the installer which creates a zip file
    • Extract the following dlls from the binaries folder of the zip file:
      • Microsoft.WindowsAPICodePack.dll
      • Microsoft.WindowsAPICodePack.Shell.dll

      -

        int max = 100;
        var prog = Microsoft.WindowsAPICodePack.Taskbar.TaskbarManager.Instance;
        prog.SetProgressState(Microsoft.WindowsAPICodePack.Taskbar.TaskbarProgressBarState.Normal);
        for(int i=0;i<max;i++) {
           prog.SetProgressValue(i, max);
           Thread.Sleep(100);     
        }
        prog.SetProgressState(Microsoft.WindowsAPICodePack.Taskbar.TaskbarProgressBarState.NoProgress);
      

      这篇关于在C#任务栏上的Windows 7进度条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆