duoxianchengxianshijindutiao

所属分类:进程与线程
开发工具:C#
文件大小:39KB
下载次数:4
上传日期:2013-11-28 10:51:28
上 传 者wanghaopeng
说明:  通过多线程的方式显示进度条的进度,比普通方式显示的进度更精确
(Display the progress bar s progress by means of multi-thread, shows the progress of the more accurate than the ordinary way )

文件列表:
WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.exe (10240, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.pdb (28160, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.vshost.exe (14328, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug\WindowsFormsApplication2.vshost.exe.manifest (490, 2007-07-21)
WindowsFormsApplication2\WindowsFormsApplication2\Form1.cs (3108, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\Form1.Designer.cs (2535, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\Form1.resx (5814, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.csproj.FileListAbsolute.txt (811, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.csproj.GenerateResource.Cache (847, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.exe (10240, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.Form1.resources (180, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.pdb (28160, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\obj\Debug\WindowsFormsApplication2.Properties.Resources.resources (180, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\Program.cs (505, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\Properties\AssemblyInfo.cs (1404, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\Properties\Resources.Designer.cs (2898, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\Properties\Resources.resx (5612, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\Properties\Settings.Designer.cs (1109, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\Properties\Settings.settings (249, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\WindowsFormsApplication2.csproj (3837, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2.sln (962, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2.suo (14848, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\obj\Debug\TempPE (0, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\bin\Debug (0, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\obj\Debug (0, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\bin (0, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\obj (0, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2\Properties (0, 2008-10-12)
WindowsFormsApplication2\WindowsFormsApplication2 (0, 2008-10-12)
WindowsFormsApplication2 (0, 2008-10-12)

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace WindowsFormsApplication2 { /// /// 线程处理方法 /// public class ThreadMethod { /// /// 线程开始事件 /// public event EventHandler threadStartEvent; /// /// 线程执行时事件 /// public event EventHandler threadEvent; /// /// 线程结束事件 /// public event EventHandler threadEndEvent; public void runMethod() { int count = 100; //执行多少次 threadStartEvent.Invoke(count, new EventArgs());//通知主界面,我开始了,count用来设置进度条的最大值 for (int i = 0; i < count; i++) { Thread.Sleep(100);//休息100毫秒,模拟执行大数据量操作 threadEvent.Invoke(i, new EventArgs());//通知主界面我正在执行,i表示进度条当前进度 } threadEndEvent.Invoke(new object(), new EventArgs());//通知主界面我已经完成了 } } }

近期下载者

相关文件


收藏者