Processing of large Copy files or network access is suspended. Add a progress bar with multiple threads (only show running, no progress) to indicate running status. Okay, let's just talk about it. The previous example. First look at the result diagram:
Program description:
Click "Button" to run a data accumulator. the textBox displays the result of each operation. ProgressBar indicates the running status.
Okay, paste the Code directly:
01
using
System;
02
using
System.Collections.Generic;
03
using
System.ComponentModel;
04
using
System.Data;
05
using
System.Drawing;
06
using
System.Linq;
07
using
System.Text;
08
using
System.Windows.Forms;
09
using
System.Threading;
10
11
namespace
Testpro
12
{
13
public
partial
class
Form1 : Form
14
{
15
BackgroundWorker work =
new
BackgroundWorker();
16
public
Form1()
17
{
18
InitializeComponent();
19
work.WorkerReportsProgress =
true
;
20
work.DoWork += Count;
21
work.RunWorkerCompleted += completeRun;
22
Control.CheckForIllegalCrossThreadCalls =
false
;
23
this
.textBox1.ScrollBars = ScrollBars.Both;
24
}
25
26