private void toolStripMenuItem3_Click(object sender, EventArgs e) { Statistics.Columns.Clear(); Statistics.Columns.Add("NN", "� �/�"); label19.Text = "������ ���� ����������, ����������� � ������� � ����� �� " + DateTime.Now.ToShortDateString() + " :"; label18.Text = ""; Statistics.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None; backgroundWorker1.RunWorkerAsync(); RndPrg = new ExtGui.RoundProgress(); RndPrg.Visible = true; RndPrg.Name = "progress"; tabControl1.TabPages[1].Controls.Add(RndPrg); RndPrg.BringToFront(); RndPrg.Size = new Size(40, 60); RndPrg.Location = new Point(450, 200); RndPrg.BackColor = SystemColors.AppWorkspace; //int p1 = 0; //int p2 = 0; //Action<int> //backgroundWorker2.RunWorkerAsync(); /*progressBar1.Invoke(delegate() { progressBar1.Value = p1; }); /*delegate() { while (p1 != 100) { p1++; Thread.CurrentThread.Join(1000); progressBar1.Invoke((ThreadStart)delegate() { progressBar1.Value = p1; }); } };*/ //------------------------------------------------------ /*new Thread(delegate() { while (p1 != 100) { p1++; Thread.CurrentThread.Join(1000); progressBar1.Invoke((ThreadStart)delegate() { progressBar1.Value = p1; }); } }).Start();*/ //backgroundWorker2.RunWorkerAsync(backgroundWorker1.IsBusy); //Statistics.DataSource = dbw.GetAllBooks(); /*autoinc(Statistics); Statistics.Columns[0].Width = 50; Statistics.Columns[1].HeaderText = "����� �����"; Statistics.Columns[1].Width = 140; Statistics.Columns[2].HeaderText = "��������"; Statistics.Columns[2].Visible = false; Statistics.Columns[3].HeaderText = "��������"; Statistics.Columns[3].Width = 330; Statistics.Columns[4].HeaderText = "�����"; Statistics.Columns[4].Width = 150; Statistics.Columns[5].HeaderText = "��� �������"; Statistics.Columns[5].Width = 70; Statistics.Columns[6].HeaderText = "�������� ������"; Statistics.Columns[6].Width = 80; Statistics.Columns[7].Visible = false; Statistics.Columns[8].Visible = false; Statistics.Columns[8].DefaultCellStyle.WrapMode = DataGridViewTriState.True; Statistics.Columns[9].HeaderText = "������"; Statistics.Columns[9].Width = 100; Sorting.WhatStat = Stats.AllBooks; Sorting.AuthorSort = SortDir.None; Sorting.ZagSort = SortDir.None; //Statistics. //Statistics.Columns[0].SortMode = DataGridViewColumnSortMode.Programmatic; //Statistics.Columns[2].SortMode = DataGridViewColumnSortMode.; button12.Enabled = true;*/ }
private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e) { /*Action dlg = delegate() { if (progressBar1.Value == 100) progressBar1.Value = 0; progressBar1.Value += 1; }; while (backgroundWorker1.IsBusy) { //Thread.CurrentThread.Join(500); Thread.Sleep(500); this.Invoke(dlg); }*/ Action delegProgress = delegate() { RndPrg = new ExtGui.RoundProgress(); RndPrg.Visible = true; RndPrg.Name = "progress"; tabControl1.TabPages[1].Controls.Add(RndPrg); RndPrg.BringToFront(); RndPrg.Size = new Size(40, 60); RndPrg.Location = new Point(450, 200); RndPrg.BackColor = SystemColors.AppWorkspace; }; this.Invoke(delegProgress); }