-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm5.cs
88 lines (60 loc) · 2.38 KB
/
Form5.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using System;
using System.Drawing;
using System.Security.Cryptography.X509Certificates;
using System.Windows.Forms;
namespace ThreadSort
{
public class Form5 : Form
{
int rowWidth = 400;
int rowHeight = 20;
int spaceBetweenRows = 10;
private int[] data;
private ProgressBar[] pBars;
public Form5(int[] field)
{
this.data = field;
//ProgressBar[] pBars = new ProgressBar[field.Length];
this.pBars = new ProgressBar[field.Length];
for (int i = 0;i< field.Length; i++) {
pBars[i] = new ProgressBar();
pBars[i].Value = field[i];
//showData();
pBars[i].Location = new Point(10, (spaceBetweenRows + rowHeight) * i);
pBars[i].Name = "pBar" + i;
pBars[i].Size = new Size(rowWidth, rowHeight);
Controls.Add(pBars[i]);
int clientHeight = (rowHeight + spaceBetweenRows) * field.Length + spaceBetweenRows; //+ rowHeight;
int clientWidth = rowWidth + 2 * spaceBetweenRows; // Přidáme okraje vlevo a vpravo
ClientSize = new Size(clientWidth, clientHeight);
}
}
private System.Windows.Forms.ProgressBar pBar1;
private System.Windows.Forms.ProgressBar pBar2;
private void InitializeComponent()
{
this.SuspendLayout();
//
// Form3
//
this.BackColor = System.Drawing.SystemColors.ControlLight;
this.ClientSize = new System.Drawing.Size(284, 261);
this.Name = "Form3";
this.Text = "ProgressBar";
this.Load += new System.EventHandler(this.Form3_Load);
this.ResumeLayout(false);
}
public void showData() {
for (int i = 0; i < data.Length; i++)
{
pBars[i].Value = data[i];
//Console.WriteLine(pBars[i].Value);
pBars[i].Refresh();
System.Threading.Thread.Sleep(100);
}
}
private void Form3_Load(object sender, EventArgs e)
{
}
}
}