-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form2.cs
61 lines (55 loc) · 1.9 KB
/
Form2.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
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using static Group_choice_algos_fuzzy.ClassOperations.OPS_GraphDrawing;
namespace Group_choice_algos_fuzzy
{
public partial class Form2 : Form, IFromGraphsDraw
{
public Form2()
{
InitializeComponent();
}
public Form2(Dictionary<string, double[,]> labeled_matrices)
{
InitializeComponent();
Redraw(labeled_matrices);
}
public void Redraw(Dictionary<string, double[,]> labeled_matrices)
{
tableLayoutPanel1.Controls.Clear();
var K = labeled_matrices.Count;
//var CCnt = tableLayoutPanel1.ColumnCount;
tableLayoutPanel1.GrowStyle = TableLayoutPanelGrowStyle.AddRows;
tableLayoutPanel1.AutoScroll = true;
tableLayoutPanel1.Padding = new Padding(0);
tableLayoutPanel1.Margin = new Padding(0);
var pb_list = new PictureBox[K];
var lb_list = new System.Windows.Forms.Label[K];
for (int k = 0; k < K; k++)
{
lb_list[k] = new Label();
pb_list[k] = new PictureBox();
lb_list[k].Text = labeled_matrices.ElementAt(k).Key;
lb_list[k].AutoSize = false;
lb_list[k].Dock = DockStyle.Fill;
DrawGraph(labeled_matrices.ElementAt(k).Value, pb_list[k]);
pb_list[k].SizeMode = PictureBoxSizeMode.StretchImage;
pb_list[k].Dock = DockStyle.Fill;
var container = new TableLayoutPanel();
container.AutoScroll = true;
container.Padding = new Padding(0);
container.Margin = new Padding(0);
container.Controls.Add(pb_list[k]);
container.Controls.Add(lb_list[k]);
container.Dock = DockStyle.Fill;
container.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
container.RowStyles.Add(new RowStyle(SizeType.Percent,20F));
//var pos_lab = new TableLayoutPanelCellPosition(k % CCnt, k/CCnt - k % (CCnt));
//tableLayoutPanel1.SetCellPosition(container, pos_lab);
this.tableLayoutPanel1.Controls.Add(container);
}
}
}
}