-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathForm1.cs
More file actions
31 lines (23 loc) · 960 Bytes
/
Copy pathForm1.cs
File metadata and controls
31 lines (23 loc) · 960 Bytes
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
using System;
using System.Drawing;
using System.Windows.Forms;
namespace TestProject1 {
public partial class Form1 : Form {
readonly Color[] colors = new Color[] { Color.Red, Color.Green, Color.LightBlue, Color.Orange, Color.Purple, Color.Gold };
public Form1() {
InitializeComponent();
var itemsControl = new ItemsControl();
int count = 100000;
var rnd = new Random();
for(int n = 0; n < count; n++) {
int width = rnd.Next(50, 200);
int height = rnd.Next(50, 200);
var color = colors[n % colors.Length];
itemsControl.Items.Add(new Item() { Size = new Size(width, height), Color = color });
}
itemsControl.Dock = DockStyle.Fill;
itemsControl.Parent = this;
}
Color CalcColor(int index) => colors[index % colors.Length];
}
}