Ejemplo n.º 1
0
        private void AddToList1()
        {
            table1.Items.Clear();
            List <int> list = new List <int>();
            string     str  = "";

            for (int i = 0; i < columns.Length; i++)
            {
                list.Add(Algorithm.max(columns[i]));
            }
            int max     = Algorithm.max(list.ToArray());
            int mnumlen = Algorithm.max(columns.Length.ToString().Length, max.ToString().Length);

            str = "№" + Spases(columns.Length.ToString().Length - 1) + "|";
            for (int i = 0; i < columns.Length; i++)
            {
                str += "S" + i.ToString() + Spases(mnumlen - i.ToString().Length - 1) + "|";
            }
            table1.Items.Add(str);
            str = "";
            for (int i = -1; i < columns.Length; i++)
            {
                for (int j = 0; j < (i == -1 ? columns.Length.ToString().Length : mnumlen); j++)
                {
                    str += "-";
                }
                str += "|";
            }
            table1.Items.Add(str);
            for (int i = 0; i < columns[0].Length; i++)
            {
                str  = "";
                str += (i + 1).ToString() + Spases(columns.Length.ToString().Length - i.ToString().Length) + "|";
                for (int j = 0; j < columns.Length; j++)
                {
                    str += columns[j][i].ToString() + Spases(mnumlen - columns[j][i].ToString().Length) + "|";
                }
                table1.Items.Add(str);
            }
        }