using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using System.Diagnostics;
namespace WindowsFormsApplication12
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
p rivate void button1_Click(object sender, EventArgs e)
{
Thread myThread = new Thread(new ThreadStart(threadfun));
myThread.Start();
}
p rivate void threadfun()
{
MethodInvoker mi = new MethodInvoker(this.invokefun);
for (int i = 0; i < 100; i++)
{
this.BeginInvoke(mi);
Thread.Sleep(30);
}
}
p rivate void invokefun()
{
if (progressBar1.Value < 100)
{
progressBar1.Value += 1;
}
}
}
}