Exemple #1
0
        private void createList(GameItem[] items)
        {
            foreach (GameItem item in items)
            {
                String[] strings = item.getString();

                    TableLayoutPanel gameinfo = new TableLayoutPanel();
                    gameinfo.ColumnCount = 7;
                    gameinfo.RowCount = 2;

                foreach (String str in strings)
                {
                    Label label = new Label();
                    label.Text = str;

                    label.Anchor = (AnchorStyles.Left | AnchorStyles.Right);
                    label.TextAlign = ContentAlignment.MiddleCenter;

                    gameinfo.Controls.Add(label);

                }

                gameinfo.BackColor = item.getColor();

                    gameinfo.AutoSize = true;

                    table.Controls.Add(gameinfo);

                }
        }
Exemple #2
0
        public Form2()
        {
            InitializeComponent();

            table = new TableLayoutPanel();
            table.ColumnCount = 1;
            table.RowCount = 1;

            container.Controls.Add(table);
               // table.Size = table.Parent.Size;
            table.AutoSize = true;
            //table.AutoScroll = true;
            /* Padding margin = table.Margin;
             margin.Right = 20;
             margin.Left = 20;
             table.Margin = margin;*/
            for (int i = 0; i < 5; i++)
            {
                GameItem[] items = new GameItem[3];
                items[0] = new GameItem("10", "10", "3", "16", "10", "CT", "de_dust2");
                items[1] = new GameItem("10", "10", "3", "10", "16", "CT", "de_dust2");
                items[2] = new GameItem("10", "10", "3", "15", "15", "CT", "de_dust2");

                createList(items);
            }
        }