Пример #1
0
 void RunThread()
 {
     //progressBar1.Invoke(ctrl_text, progressBar1, 0);
     ////progressBar1.Value = 0;
     //for (int i = 0; i <= 100; i++)
     //{
     //    progressBar1.Invoke(ctrl_text, progressBar1, i);
     //    label1.Invoke(ctrl_text, label1, i + "%");
     //    //grfx.DrawLine(Pens.Red, new Point(progressBar1.Value * 4, 0), new Point(progressBar1.Value * 4, 400));
     //    Thread.Sleep(200);
     //}
     try
     {
         if (fins.InvokeRequired)
         {
             fins.BeginInvoke(cl_frm, fins);
         }
         else
         {
             fins.Invoke(cl_frm, fins);
         }
     }
     catch (Exception ex) { }
     finally
     {
         fins      = new frm_ProgressBar();
         fins.Text = Title;
         fins.ShowDialog();
     }
 }
Пример #2
0
 public static void ON(string title)
 {
     if (On)
     {
         return;
     }
     OFF();
     On    = true;
     thd   = null;
     Title = title;
     if (fins == null)
     {
         fins = new frm_ProgressBar();
     }
     thd = new Thread(new ThreadStart(fins.RunThread));
     //thd.SetApartmentState(ApartmentState.STA);
     thd.Start();
 }