}//调整连续列列宽 public ProgressBar(FileInfo[] WdataFile2, string ResourePath2, string Scols2, int a) { setCallBack = new setTextValueCallBack(SetValue); setCallBack2 = new setTextValueCallBack2(ChangeProgress); switch (a) { case 2: ExcelWay = new setExcelWay(DeleteCol); break; case 3: ExcelWay = new setExcelWay(DeleteRow); break; case 4: ExcelWay = new setExcelWay(DeleteFormula); break; case 5: ExcelWay = new setExcelWay(ChangeType); break; default: break; } width = a; Scols = Scols2; ResourePath = ResourePath2; WdataFile = WdataFile2; InitializeComponent(); timer1.Enabled = true; }//删除单列//删除单行
}//连续空缺天数重载 public ProgressBar(FileInfo[] WdataFile2, string ResourePath2, string ExportPath2, double a) { InitializeComponent(); setCallBack = new setTextValueCallBack(SetValue); setCallBack2 = new setTextValueCallBack2(ChangeProgress); switch (a) { case 0.1: ExcelWay = new setExcelWay(SingleRow); break; case 0.2: ExcelWay = new setExcelWay(INPUT); break; case 0.3: ExcelWay = new setExcelWay(OUTPUT); break; default: break; } ExportPath = ExportPath2; ResourePath = ResourePath2; WdataFile = WdataFile2; ExcelProcess2 = new ExcelProcess(); timer1.Enabled = true; }//非连续空缺天数重载
private void btn_Click(object sender, EventArgs e) { setCallBack = new setTextValueCallBack(setValue); Thread thread = new Thread(new ThreadStart(Test)); thread.IsBackground = true; thread.Start(); }
}//删除单列//删除单行 public ProgressBar(FileInfo[] WdataFile2, string ResourePath2, string Scols2, int width2, string a) { setCallBack = new setTextValueCallBack(SetValue); ExcelWay = new setExcelWay(AdjustColumn); width = width2; Scols = Scols2; ResourePath = ResourePath2; WdataFile = WdataFile2; InitializeComponent(); timer1.Enabled = true; }//调整单列列宽
private void btn_Test_Click(object sender, EventArgs e) { //实例化回调 setCallBack = new setTextValueCallBack(SetValue); //创建一个线程去执行这个方法:创建的线程默认是前台线程 Thread thread = new Thread(new ThreadStart(Test)); //Start方法标记这个线程就绪了,可以随时被执行,具体什么时候执行这个线程,由CPU决定 //将线程设置为后台线程 thread.IsBackground = true; thread.Start(); }
public void SetText(string text) { if (this.RStextBox.InvokeRequired) { setTextValueCallBack setCallBack = new setTextValueCallBack(SetText); this.Invoke(setCallBack, new object[] { text }); } else { this.RStextBox.AppendText(text); } }
}//另存重载 public ProgressBar(FileInfo[] WdataFile2, string ResourePath2, string Days2, string ExportPath2, string a) { Days = Days2; setCallBack = new setTextValueCallBack(SetValue); setCallBack2 = new setTextValueCallBack2(ChangeProgress); ExcelWay = new setExcelWay(SuccessionRow); ExportPath = ExportPath2; ResourePath = ResourePath2; WdataFile = WdataFile2; InitializeComponent(); timer1.Enabled = true; }//连续空缺天数重载
public ProgressBar(FileInfo[] WdataFile2, string ResourePath2, string SaveType2, string ExportPath2) { SaveType = SaveType2; setCallBack = new setTextValueCallBack(SetValue); setCallBack2 = new setTextValueCallBack2(ChangeProgress); ExcelWay = new setExcelWay(SaveAs2); ExportPath = ExportPath2; ResourePath = ResourePath2; WdataFile = WdataFile2; InitializeComponent(); timer1.Enabled = true; }//另存重载
}//调整单列列宽 public ProgressBar(FileInfo[] WdataFile2, string ResourePath2, string Row2, string Column2, string Data2, int c) { setCallBack = new setTextValueCallBack(SetValue); setCallBack2 = new setTextValueCallBack2(ChangeProgress); ExcelWay = new setExcelWay(AddData); Row = Row2; Column = Column2; Data = Data2; ResourePath = ResourePath2; WdataFile = WdataFile2; InitializeComponent(); timer1.Enabled = true; }//添加数据
}//非连续空缺天数重载 public ProgressBar(FileInfo[] WdataFile2, string ResourePath2, string Mcols2, string Gcols2, int a) { setCallBack = new setTextValueCallBack(SetValue); setCallBack2 = new setTextValueCallBack2(ChangeProgress); switch (a) { case 1: ExcelWay = new setExcelWay(MoveCols); break; case 2: ExcelWay = new setExcelWay(DeleteCols); break; case 3: ExcelWay = new setExcelWay(DeleteRows); break; case 4: ExcelWay = new setExcelWay(AddFormula); break; case 5: ExcelWay = new setExcelWay(DeleteFormulas); break; case 6: ExcelWay = new setExcelWay(ZSSunlight); break; case 8: ExcelWay = new setExcelWay(WeatherTool); break; default: break; } LatPath = Gcols2; Column = Mcols2; Formula = Gcols2; width = a; Mcols = Mcols2; Gcols = Gcols2; param = Gcols2; ResourePath = ResourePath2; ExportPath = Mcols2; WdataFile = WdataFile2; InitializeComponent(); timer1.Enabled = true; }//移动列的重载/删除多列/删除多行
private void btn2_Click(object sender, RoutedEventArgs e) { clearComments(); //实例化回调 setCallBack = new setTextValueCallBack(showComment); //创建无参的线程 Thread thread1 = new Thread(new ThreadStart(Thread1)); //调用Start方法执行线程 thread1.Start(); //创建ThreadTest类的一个实例 ThreadTest test = new ThreadTest(this); //调用test实例的MyThread方法 Thread thread2 = new Thread(new ThreadStart(test.Thread2)); //启动线程 thread2.Start(); //通过匿名委托创建 Thread thread3 = new Thread(delegate() { update("我是通过匿名委托创建的线程"); }); thread3.Start(); //通过Lambda表达式创建 Thread thread4 = new Thread(() => update("我是通过Lambda表达式创建的委托")); thread4.Start(); //通过ParameterizedThreadStart创建线程 Thread thread5 = new Thread(new ParameterizedThreadStart(Thread5)); //给方法传值 thread5.Start("这是一个有参数的委托"); //Console.ReadKey(); }