<tfoot id='fBHok'></tfoot>
  • <small id='fBHok'></small><noframes id='fBHok'>

    <legend id='fBHok'><style id='fBHok'><dir id='fBHok'><q id='fBHok'></q></dir></style></legend>

    1. <i id='fBHok'><tr id='fBHok'><dt id='fBHok'><q id='fBHok'><span id='fBHok'><b id='fBHok'><form id='fBHok'><ins id='fBHok'></ins><ul id='fBHok'></ul><sub id='fBHok'></sub></form><legend id='fBHok'></legend><bdo id='fBHok'><pre id='fBHok'><center id='fBHok'></center></pre></bdo></b><th id='fBHok'></th></span></q></dt></tr></i><div id='fBHok'><tfoot id='fBHok'></tfoot><dl id='fBHok'><fieldset id='fBHok'></fieldset></dl></div>
          <bdo id='fBHok'></bdo><ul id='fBHok'></ul>

      1. C#任务栏中的Windows 7进度条?

        Windows 7 progress bar in taskbar in C#?(C#任务栏中的Windows 7进度条?)
          <tbody id='rmcQz'></tbody>
        <tfoot id='rmcQz'></tfoot>

          • <small id='rmcQz'></small><noframes id='rmcQz'>

            • <bdo id='rmcQz'></bdo><ul id='rmcQz'></ul>

              1. <i id='rmcQz'><tr id='rmcQz'><dt id='rmcQz'><q id='rmcQz'><span id='rmcQz'><b id='rmcQz'><form id='rmcQz'><ins id='rmcQz'></ins><ul id='rmcQz'></ul><sub id='rmcQz'></sub></form><legend id='rmcQz'></legend><bdo id='rmcQz'><pre id='rmcQz'><center id='rmcQz'></center></pre></bdo></b><th id='rmcQz'></th></span></q></dt></tr></i><div id='rmcQz'><tfoot id='rmcQz'></tfoot><dl id='rmcQz'><fieldset id='rmcQz'></fieldset></dl></div>
              2. <legend id='rmcQz'><style id='rmcQz'><dir id='rmcQz'><q id='rmcQz'></q></dir></style></legend>

                  本文介绍了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.

                  推荐答案

                  我只是想在我的 WinForms 应用程序中添加一些任务栏进度动画,无需下载代码包或切换到 WPF 即可使用 TaskbarItemInfo.

                  I just wanted to add some taskbar progress animation to my WinForms application, without having to download code packs or switch to WPF to use TaskbarItemInfo.

                  解决方案是使用 ITaskbarList3 接口的类:

                  The solution was a class that uses the ITaskbarList3 interface:

                  using System;
                  using System.Runtime.InteropServices;
                  
                  public static class TaskbarProgress
                  {
                      public enum TaskbarStates
                      {
                          NoProgress    = 0,
                          Indeterminate = 0x1,
                          Normal        = 0x2,
                          Error         = 0x4,
                          Paused        = 0x8
                      }
                  
                      [ComImport()]
                      [Guid("ea1afb91-9e28-4b86-90e9-9e9f8a5eefaf")]
                      [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
                      private interface ITaskbarList3
                      {
                          // ITaskbarList
                          [PreserveSig]
                          void HrInit();
                          [PreserveSig]
                          void AddTab(IntPtr hwnd);
                          [PreserveSig]
                          void DeleteTab(IntPtr hwnd);
                          [PreserveSig]
                          void ActivateTab(IntPtr hwnd);
                          [PreserveSig]
                          void SetActiveAlt(IntPtr hwnd);
                  
                          // ITaskbarList2
                          [PreserveSig]
                          void MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen);
                  
                          // ITaskbarList3
                          [PreserveSig]
                          void SetProgressValue(IntPtr hwnd, UInt64 ullCompleted, UInt64 ullTotal);
                          [PreserveSig]
                          void SetProgressState(IntPtr hwnd, TaskbarStates state);
                      }
                  
                      [ComImport()]    
                      [Guid("56fdf344-fd6d-11d0-958a-006097c9a090")]
                      [ClassInterface(ClassInterfaceType.None)]
                      private class TaskbarInstance
                      {
                      }
                  
                      private static ITaskbarList3 taskbarInstance = (ITaskbarList3)new TaskbarInstance();
                      private static bool taskbarSupported = Environment.OSVersion.Version >= new Version(6, 1);
                  
                      public static void SetState(IntPtr windowHandle, TaskbarStates taskbarState)
                      {
                          if (taskbarSupported) taskbarInstance.SetProgressState(windowHandle, taskbarState);
                      }
                  
                      public static void SetValue(IntPtr windowHandle, double progressValue, double progressMax)
                      {
                          if (taskbarSupported) taskbarInstance.SetProgressValue(windowHandle, (ulong)progressValue, (ulong)progressMax);
                      }
                  }
                  

                  简单易用的示例:

                  TaskbarProgress.SetState(this.Handle, TaskbarProgress.TaskbarStates.Indeterminate);
                  
                  or
                  
                  TaskbarProgress.SetValue(this.Handle, 50, 100);
                  TaskbarProgress.SetState(this.Handle, TaskbarProgress.TaskbarStates.Error);
                  

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

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Adding and removing users from Active Directory groups in .NET(在 .NET 中的 Active Directory 组中添加和删除用户)
                  set equality in linq(在 linq 中设置相等)
                  HashSet conversion to List(HashSet 转换为 List)
                  How to set timeout for webBrowser navigate event(如何为 webBrowser 导航事件设置超时)
                  Test whether two IEnumerablelt;Tgt; have the same values with the same frequencies(测试两个IEnumerablelt;Tgt;具有相同频率的相同值)
                  How do you determine if two HashSets are equal (by value, not by reference)?(您如何确定两个 HashSet 是否相等(按值,而不是按引用)?)
                  <legend id='wXXAQ'><style id='wXXAQ'><dir id='wXXAQ'><q id='wXXAQ'></q></dir></style></legend>
                    • <bdo id='wXXAQ'></bdo><ul id='wXXAQ'></ul>
                        <i id='wXXAQ'><tr id='wXXAQ'><dt id='wXXAQ'><q id='wXXAQ'><span id='wXXAQ'><b id='wXXAQ'><form id='wXXAQ'><ins id='wXXAQ'></ins><ul id='wXXAQ'></ul><sub id='wXXAQ'></sub></form><legend id='wXXAQ'></legend><bdo id='wXXAQ'><pre id='wXXAQ'><center id='wXXAQ'></center></pre></bdo></b><th id='wXXAQ'></th></span></q></dt></tr></i><div id='wXXAQ'><tfoot id='wXXAQ'></tfoot><dl id='wXXAQ'><fieldset id='wXXAQ'></fieldset></dl></div>

                              <tbody id='wXXAQ'></tbody>

                            <tfoot id='wXXAQ'></tfoot>

                            <small id='wXXAQ'></small><noframes id='wXXAQ'>