Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int onceMore = 0;
- for (int i = 0; i < Nodes.Nodes.Count; i++)
- {
- var activeNode = Nodes.Nodes[i];
- var numberOfColumns = activeNode.Nodes.Count * 2 + 1;
- //var row = new Object[activeNode.Nodes.Count];
- dataGridView1.ColumnCount = numberOfColumns;
- dataGridView1.RowCount = activeNode.Nodes.Count;
- OnceAgain:
- onceMore++;
- for (int j = 0; j < activeNode.Nodes.Count; j++)
- {
- if (onceMore == 1)
- {
- dataGridView1.Columns[j].Name = activeNode.Nodes[j].Text;
- dataGridView1.Rows[j].HeaderCell.Value = activeNode.Nodes[j].Text;
- }
- else
- {
- var index = j + (activeNode.Nodes.Count - j) + j;
- dataGridView1.Columns[index].Name = activeNode.Nodes[j].Text + " Koristnost";
- }
- if (onceMore < 2 && j == activeNode.Nodes.Count - 1)
- {
- goto OnceAgain;
- }
- if (j == activeNode.Nodes.Count - 1)
- {
- dataGridView1.Columns[numberOfColumns - 1].Name = "Weights";
- }
- }
- for(int row=0; row < dataGridView1.RowCount; row++)
- {
- for(int column = 0; column < dataGridView1.ColumnCount; column++)
- {
- if(row == column)
- {
- dataGridView1[row, column].Value = 1;
- dataGridView1[row, column].ReadOnly = true;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement